| | |
| | | |
| | | #region ◆ 变量申明__________________________ |
| | | ZigBee.Device.DoorLock doorLock; |
| | | VerticalScrolViewLayout bodyView; |
| | | VerticalRefreshLayout bodyView; |
| | | Button currentMethod;// 当前选择的方式 |
| | | Shared.Phone.UserCenter.MemberInfoRes curAccountObj; |
| | | Button entryStatusPic; |
| | | Button btnPicTip; |
| | | Button btnPicTip1; |
| | | bool isSecondDel; |
| | | FrameLayout blankFrameLayout; |
| | | #endregion |
| | | |
| | | void ReadDoorLockUserInfo() |
| | | { |
| | | System.Threading.Tasks.Task.Run(async () => |
| | | { |
| | | Application.RunOnMainThread(() => { CommonPage.Loading.Start("Loading..."); }); |
| | | try |
| | | { |
| | | var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); |
| | |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | RefreshList(); |
| | | // 类型区分 |
| | | TypeRefresh(); |
| | | CommonPage.Loading.Hide(); |
| | | }); |
| | | } |
| | |
| | | /// </summary> |
| | | public void Show() |
| | | { |
| | | doorLock.currentUserDisplayMethod = ""; |
| | | this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.LockMethod)); |
| | | this.btnTitleLine.Visible = false; |
| | | EventHandler<MouseEventArgs> eHandlerBack = (sender, e) => |
| | |
| | | { |
| | | btnAddFrameLayout.Width = Application.GetRealWidth(72); |
| | | } |
| | | MidFrameLayoutContent(); |
| | | |
| | | if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) |
| | | { |
| | | CommonPage.Loading.Start("Loading..."); |
| | | ReadDoorLockUserInfo(); |
| | | } |
| | | else |
| | | { |
| | | MidFrameLayoutContent(); |
| | | RefreshList(); |
| | | } |
| | | } |
| | | //中部布局 |
| | | void MidFrameLayoutContent() |
| | | { |
| | | #region 开锁方式UI |
| | | var midTopFrameLayout = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(115), |
| | |
| | | Y = Application.GetRealHeight(35), |
| | | X = Application.GetRealWidth(812 - 100), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | Text = Language.StringByID(R.MyInternationalizationString.AllMethod), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMTopTitleText, |
| | | TextSize = 12, |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnAllMethod); |
| | | // 类型区分 |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod)) |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock)) |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock)) |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); |
| | | } |
| | | else |
| | | { |
| | | btnAllMethod.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); |
| | | } |
| | | |
| | | var btnNext = new Button() |
| | | { |
| | |
| | | }; |
| | | midTopFrameLayout.AddChidren(btnNext); |
| | | |
| | | entryStatusPic = new Button |
| | | btnNext.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | X = Application.GetRealWidth(164), |
| | | Y = Application.GetRealHeight(492), |
| | | Height = Application.GetRealHeight(435), |
| | | Width = Application.GetRealWidth(757), |
| | | Visible = false, |
| | | UnSelectedImagePath = "DoorLock/UnLockBlankPic.png", |
| | | SideslipFramelayout(); |
| | | }; |
| | | this.midFrameLayout.AddChidren(entryStatusPic); |
| | | |
| | | btnPicTip = new Button |
| | | { |
| | | X = Application.GetRealWidth(397), |
| | | Y = Application.GetRealHeight(1143 - 184), |
| | | Height = Application.GetRealHeight(98 / 2), |
| | | Text = Language.StringByID(R.MyInternationalizationString.NoPasswordInformation), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Visible = false, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnPicTip); |
| | | |
| | | btnPicTip1 = new Button |
| | | { |
| | | X = Application.GetRealWidth(397), |
| | | Y = btnPicTip.Bottom, |
| | | Height = Application.GetRealHeight(98 / 2), |
| | | Text = Language.StringByID(R.MyInternationalizationString.NoPasswordInformation1), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Visible = false, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnPicTip1); |
| | | |
| | | var btnLine = new Button |
| | | { |
| | | Y = midTopFrameLayout.Bottom, |
| | |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMTitleLine, |
| | | }; |
| | | this.midFrameLayout.AddChidren(btnLine); |
| | | #endregion |
| | | |
| | | bodyView = new VerticalScrolViewLayout() |
| | | bodyView = new VerticalRefreshLayout() |
| | | { |
| | | Y = btnLine.Bottom, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | Height = Application.GetRealHeight(1921 - 184 - 116), |
| | | }; |
| | | this.midFrameLayout.AddChidren(bodyView); |
| | | |
| | | btnNext.MouseUpEventHandler += (sender, e) => |
| | | bodyView.BeginHeaderRefreshingAction += () => |
| | | { |
| | | SideslipFramelayout(); |
| | | }; |
| | | if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) |
| | | { |
| | | bodyView.BeginHeaderRefreshing(); |
| | | ReadDoorLockUserInfo(); |
| | | } |
| | | else |
| | | bodyView.EndHeaderRefreshing(); |
| | | }; |
| | | BlankPicUI(); |
| | | } |
| | | |
| | | void BlankPicUI() |
| | | { |
| | | blankFrameLayout = new FrameLayout |
| | | { |
| | | RefreshList(); |
| | | } |
| | | }; |
| | | bodyView.AddChidren(blankFrameLayout); |
| | | |
| | | entryStatusPic = new Button |
| | | { |
| | | X = Application.GetRealWidth(164), |
| | | Y = Application.GetRealHeight(377), |
| | | Height = Application.GetRealHeight(435), |
| | | Width = Application.GetRealHeight(757), |
| | | Visible = false, |
| | | UnSelectedImagePath = "DoorLock/UnLockBlankPic.png", |
| | | }; |
| | | blankFrameLayout.AddChidren(entryStatusPic); |
| | | |
| | | btnPicTip = new Button |
| | | { |
| | | X = Application.GetRealWidth(397), |
| | | Text = Language.StringByID(R.MyInternationalizationString.NoPasswordInformation), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Visible = false, |
| | | Y = Application.GetRealHeight(844), |
| | | }; |
| | | blankFrameLayout.AddChidren(btnPicTip); |
| | | |
| | | btnPicTip1 = new Button |
| | | { |
| | | X = Application.GetRealWidth(397), |
| | | Y = btnPicTip.Bottom, |
| | | Text = Language.StringByID(R.MyInternationalizationString.NoPasswordInformation1), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Visible = false, |
| | | BackgroundColor = 0xff00ff00, |
| | | }; |
| | | blankFrameLayout.AddChidren(btnPicTip1); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// </summary> |
| | | /// <param name="gateway"></param> |
| | | /// <param name="key"></param> |
| | | public void RefreshList() |
| | | public void RefreshList(int unlockMethod = -1) |
| | | { |
| | | if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); |
| | | return; |
| | | } |
| | | bodyView.RemoveAll(); |
| | | this.midFrameLayout.RemoveAll(); |
| | | MidFrameLayoutContent(); |
| | | var curAccountDoorLockUserList = new Dictionary<int, ZigBee.Device.DoorLock.LocaDoorLockObj>(); |
| | | |
| | | foreach (var curUserId in doorLock.localDoorLockUserList.Keys) |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; |
| | |
| | | entryStatusPic.Visible = true; |
| | | btnPicTip.Visible = true; |
| | | btnPicTip1.Visible = true; |
| | | blankFrameLayout.Visible = true; |
| | | entryStatusPic.Height = Application.GetRealHeight(435); |
| | | entryStatusPic.Width = Application.GetRealHeight(757); |
| | | btnPicTip.Height = Application.GetRealHeight(98 / 2); |
| | | btnPicTip1.Height = Application.GetRealHeight(98 / 2); |
| | | blankFrameLayout.Height = bodyView.Height; |
| | | } |
| | | else |
| | | { |
| | | entryStatusPic.Visible = false; |
| | | btnPicTip.Visible = false; |
| | | btnPicTip1.Visible = false; |
| | | } |
| | | if (curAccountDoorLockUserList.Keys.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | bodyView.Height = curAccountDoorLockUserList.Keys.Count * Application.GetRealHeight(127 + 23); |
| | | int i = 0; |
| | | foreach (var curUserId in curAccountDoorLockUserList.Keys) |
| | | { |
| | | var curDoorLockUser = curAccountDoorLockUserList[curUserId]; |
| | | #region UI |
| | | var rowFrameLayout = new RowLayout() |
| | | blankFrameLayout.Visible = false; |
| | | entryStatusPic.Height = Application.GetRealHeight(0); |
| | | entryStatusPic.Width = Application.GetRealHeight(0); |
| | | btnPicTip.Height = Application.GetRealHeight(0); |
| | | btnPicTip1.Height = Application.GetRealHeight(0); |
| | | blankFrameLayout.Height = Application.GetRealHeight(0); |
| | | var frameLayoutRow = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(127 + 23), |
| | | X = Application.GetRealWidth(58), |
| | | Width = Application.GetRealWidth(965), |
| | | LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | Height = Application.GetMinRealAverage(0), |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | bodyView.AddChidren(rowFrameLayout); |
| | | bodyView.AddChidren(frameLayoutRow); |
| | | int i = 0; |
| | | foreach (var curUserId in curAccountDoorLockUserList.Keys) |
| | | { |
| | | var curDoorLockUser = curAccountDoorLockUserList[curUserId]; |
| | | switch (unlockMethod) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UnlockType != unlockMethod) |
| | | { |
| | | continue; |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UnlockType != unlockMethod) |
| | | { |
| | | continue; |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UnlockType != unlockMethod) |
| | | { |
| | | continue; |
| | | } |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | |
| | | var btnPicFrameLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | X = Application.GetRealWidth(40), |
| | | Y = Application.GetRealHeight(49), |
| | | }; |
| | | rowFrameLayout.AddChidren(btnPicFrameLayout); |
| | | #region UI |
| | | var rowFrameLayout = new RowLayout() |
| | | { |
| | | Height = Application.GetRealHeight(127 + 23), |
| | | X = Application.GetRealWidth(58), |
| | | Y = i * Application.GetRealHeight(150), |
| | | Width = Application.GetRealWidth(965), |
| | | LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | }; |
| | | frameLayoutRow.AddChidren(rowFrameLayout); |
| | | |
| | | var btnPic = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(84), |
| | | Height = Application.GetRealHeight(84), |
| | | UnSelectedImagePath = "DoorLock/DoorLockUserPic.png", |
| | | }; |
| | | btnPicFrameLayout.AddChidren(btnPic); |
| | | var btnPicFrameLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | X = Application.GetRealWidth(40), |
| | | Y = Application.GetRealHeight(49), |
| | | }; |
| | | rowFrameLayout.AddChidren(btnPicFrameLayout); |
| | | |
| | | var btnDoorlockUser = new EditText() |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 173), |
| | | Height = Application.GetRealHeight(60), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(35), |
| | | TextSize = 14, |
| | | PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnDoorlockUser); |
| | | var btnPic = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(84), |
| | | Height = Application.GetRealHeight(84), |
| | | UnSelectedImagePath = "DoorLock/DoorLockUserPic.png", |
| | | }; |
| | | btnPicFrameLayout.AddChidren(btnPic); |
| | | |
| | | var btnMember = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 173), |
| | | Height = Application.GetRealHeight(49), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(95), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnMember); |
| | | var btnDoorlockUser = new EditText() |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 173), |
| | | Height = Application.GetRealHeight(60), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(35), |
| | | TextSize = 14, |
| | | PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnDoorlockUser); |
| | | |
| | | var btnDel = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 173), |
| | | Height = Application.GetRealHeight(49), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(95), |
| | | Text = Language.StringByID(R.MyInternationalizationString.DelBindDevice), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.Center, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel, |
| | | }; |
| | | rowFrameLayout.AddRightView(btnDel); |
| | | #endregion |
| | | #region 数据处理 |
| | | int currentIndex = i; |
| | | if (currentIndex == curAccountDoorLockUserList.Keys.Count - 1) |
| | | { |
| | | rowFrameLayout.LineColor = Shared.Common.ZigbeeColor.Current.XMWhite; |
| | | } |
| | | var btnMember = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 173), |
| | | Height = Application.GetRealHeight(49), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(95), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnMember); |
| | | |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | } |
| | | var btnDel = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(184), |
| | | Text = Language.StringByID(R.MyInternationalizationString.DelBindDevice), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.Center, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel, |
| | | }; |
| | | rowFrameLayout.AddRightView(btnDel); |
| | | #endregion |
| | | |
| | | if (curAccountObj.UserName == "" || curAccountObj.UserName == null) |
| | | { |
| | | btnMember.Text = curAccountObj.Account; |
| | | } |
| | | else |
| | | { |
| | | btnMember.Text = curAccountObj.UserName; |
| | | } |
| | | #region 数据处理 |
| | | int currentIndex = i; |
| | | if (currentIndex == curAccountDoorLockUserList.Keys.Count - 1) |
| | | { |
| | | rowFrameLayout.LineColor = Shared.Common.ZigbeeColor.Current.XMWhite; |
| | | } |
| | | |
| | | Action<Shared.View> action = async (obj) => |
| | | { |
| | | var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (curAccountObj.UserName == "" || curAccountObj.UserName == null) |
| | | { |
| | | btnMember.Text = curAccountObj.Account; |
| | | } |
| | | else |
| | | { |
| | | btnMember.Text = curAccountObj.UserName; |
| | | } |
| | | |
| | | Action<Shared.View> action = async (obj) => |
| | | { |
| | | refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | refreshDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | refreshDoorLockData.OpenLockMode = curDoorLockUser.UnlockType; |
| | | refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | refreshDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | refreshDoorLockData.OpenLockMode = curDoorLockUser.UnlockType; |
| | | refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | { |
| | | doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | localDoorLockObj.UnlockType = curDoorLockUser.UnlockType; |
| | | localDoorLockObj.EntryTime = curDoorLockUser.EntryTime; |
| | | localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks; |
| | | localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; |
| | | doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj); |
| | | RefreshList(); |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | { |
| | | doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | localDoorLockObj.UnlockType = curDoorLockUser.UnlockType; |
| | | localDoorLockObj.EntryTime = curDoorLockUser.EntryTime; |
| | | localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks; |
| | | localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; |
| | | doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj); |
| | | TypeRefresh(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | }; |
| | | btnDoorlockUser.EditorEnterAction += action; |
| | | }; |
| | | btnDoorlockUser.EditorEnterAction += action; |
| | | |
| | | btnDel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var alert = new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); |
| | | alert.Show(); |
| | | alert.ResultEventHandler += async (sender1, e1) => |
| | | btnDel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | if (e1) |
| | | var alert = new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); |
| | | alert.Show(); |
| | | alert.ResultEventHandler += async (sender1, e1) => |
| | | { |
| | | var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser); |
| | | var resultData = await doorLock.DefaultControlAsync(passData); |
| | | if (resultData != null && resultData.defaultControlResponseData != null) |
| | | if (e1) |
| | | { |
| | | if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2) |
| | | try |
| | | { |
| | | var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | CommonPage.Loading.Start(""); |
| | | var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser); |
| | | var resultData = await doorLock.DefaultControlAsync(passData); |
| | | if (resultData != null && resultData.defaultControlResponseData != null) |
| | | { |
| | | deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | deleteDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | deleteDoorLockData.DelDoorLockDelType = 2; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2) |
| | | { |
| | | isSecondDel = false; |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | doorLock.localDoorLockAccountList.Remove(curDoorLockUser.ConnectedAccount); |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | doorLock.localDoorLockUserList.Remove(curUserId); |
| | | doorLock.ReSave(); |
| | | RefreshList(); |
| | | deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | deleteDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //开关图标 |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | isSecondDel = true; |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (isSecondDel) |
| | | { |
| | | var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | deleteDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | deleteDoorLockData.DelDoorLockDelType = 2; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | isSecondDel = false; |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | deleteDoorLockData.DelDoorLockDelType = 2; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | { |
| | | doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | doorLock.localDoorLockUserList.Remove(curUserId); |
| | | RefreshList(); |
| | | isSecondDel = false; |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | { |
| | | doorLock.localDoorLockAccountList.Remove(curDoorLockUser.ConnectedAccount); |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | doorLock.localDoorLockUserList.Remove(curUserId); |
| | | doorLock.ReSave(); |
| | | TypeRefresh(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //开关图标 |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | isSecondDel = true; |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | isSecondDel = true; |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | if (isSecondDel) |
| | | { |
| | | var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | deleteDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | deleteDoorLockData.DelDoorLockDelType = 2; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | { |
| | | isSecondDel = false; |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | { |
| | | doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | doorLock.localDoorLockUserList.Remove(curUserId); |
| | | TypeRefresh(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | isSecondDel = true; |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curDoorLockUser.UserID < 10) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OnlyBeDeletedOnTheDevice), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curDoorLockUser.UserID < 10) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OnlyBeDeletedOnTheDevice), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | CommonPage.Loading.Hide(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | } |
| | | } |
| | | }; |
| | | }; |
| | | }; |
| | | #endregion |
| | | i++; |
| | | #endregion |
| | | i++; |
| | | } |
| | | frameLayoutRow.Height = i * Application.GetRealHeight(150); |
| | | } |
| | | } |
| | | |
| | |
| | | oldbutton = btnAllMethod; |
| | | oldbuttonText = btnMethodText; |
| | | doorLock.currentUserDisplayMethod = btnMethodText.Text; |
| | | doorLock.ReSave(); |
| | | btnAllMethod.IsSelected = true; |
| | | oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | |
| | | // 类型区分 |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod)) |
| | | { |
| | | RefreshList(); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) |
| | | { |
| | | DisplayByType(0); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock)) |
| | | { |
| | | DisplayByType(15); |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock)) |
| | | { |
| | | DisplayByType(3); |
| | | } |
| | | TypeRefresh(); |
| | | } |
| | | dialog.Close(); |
| | | }; |
| | |
| | | break; |
| | | } |
| | | |
| | | if (doorLock.currentUserDisplayMethod == "" && i == 0) |
| | | { |
| | | btnAllMethod.IsSelected = true; |
| | | btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; |
| | | oldbutton = btnAllMethod; |
| | | oldbuttonText = btnMethodText; |
| | | } |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0) |
| | | { |
| | | btnAllMethod.IsSelected = true; |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 通过类型筛选显示 |
| | | /// </summary> |
| | | public void DisplayByType(int unlockMethod) |
| | | //类型区分 |
| | | void TypeRefresh() |
| | | { |
| | | bodyView.RemoveAll(); |
| | | var curAccountDoorLockUserList = new Dictionary<int, ZigBee.Device.DoorLock.LocaDoorLockObj>(); |
| | | |
| | | foreach (var curUserId in doorLock.localDoorLockUserList.Keys) |
| | | if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) |
| | | { |
| | | var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; |
| | | |
| | | if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) |
| | | { |
| | | continue; |
| | | } |
| | | else |
| | | { |
| | | curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser); |
| | | } |
| | | RefreshList(0); |
| | | } |
| | | |
| | | if (curAccountDoorLockUserList.Count == 0) |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock)) |
| | | { |
| | | entryStatusPic.Visible = true; |
| | | btnPicTip.Visible = true; |
| | | btnPicTip1.Visible = true; |
| | | RefreshList(15); |
| | | } |
| | | else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock)) |
| | | { |
| | | RefreshList(3); |
| | | } |
| | | else |
| | | { |
| | | entryStatusPic.Visible = false; |
| | | btnPicTip.Visible = false; |
| | | btnPicTip1.Visible = false; |
| | | RefreshList(); |
| | | } |
| | | if (curAccountDoorLockUserList.Keys.Count == 0) |
| | | { |
| | | return; |
| | | } |
| | | int i = 0; |
| | | foreach (var curUserId in curAccountDoorLockUserList.Keys) |
| | | { |
| | | var curDoorLockUser = curAccountDoorLockUserList[curUserId]; |
| | | if (curDoorLockUser.UnlockType != unlockMethod) |
| | | { |
| | | continue; |
| | | } |
| | | #region UI |
| | | var rowFrameLayout = new RowLayout() |
| | | { |
| | | Height = Application.GetRealHeight(127 + 23), |
| | | X = Application.GetRealWidth(58), |
| | | Width = Application.GetRealWidth(965), |
| | | LineColor = Shared.Common.ZigbeeColor.Current.XMRowLine, |
| | | }; |
| | | bodyView.AddChidren(rowFrameLayout); |
| | | |
| | | var btnPicFrameLayout = new FrameLayout() |
| | | { |
| | | Width = Application.GetRealWidth(81), |
| | | Height = Application.GetRealHeight(81), |
| | | X = Application.GetRealWidth(40), |
| | | Y = Application.GetRealHeight(49), |
| | | }; |
| | | rowFrameLayout.AddChidren(btnPicFrameLayout); |
| | | |
| | | var btnPic = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(84), |
| | | Height = Application.GetRealHeight(84), |
| | | UnSelectedImagePath = "DoorLock/DoorLockUserPic.png", |
| | | }; |
| | | btnPicFrameLayout.AddChidren(btnPic); |
| | | |
| | | var btnDoorlockUser = new EditText() |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 173), |
| | | Height = Application.GetRealHeight(60), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(35), |
| | | TextSize = 14, |
| | | PlaceholderTextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMBlack, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnDoorlockUser); |
| | | |
| | | var btnMember = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 173), |
| | | Height = Application.GetRealHeight(49), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(95), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, |
| | | TextSize = 14, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | }; |
| | | rowFrameLayout.AddChidren(btnMember); |
| | | |
| | | var btnDel = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(1080 - 173), |
| | | Height = Application.GetRealHeight(49), |
| | | X = Application.GetRealWidth(173), |
| | | Y = Application.GetRealHeight(95), |
| | | Text = Language.StringByID(R.MyInternationalizationString.DelBindDevice), |
| | | TextColor = Shared.Common.ZigbeeColor.Current.XMWhite, |
| | | TextSize = 12, |
| | | TextAlignment = TextAlignment.Center, |
| | | BackgroundColor = Shared.Common.ZigbeeColor.Current.XMDel, |
| | | }; |
| | | rowFrameLayout.AddRightView(btnDel); |
| | | #endregion |
| | | #region 数据处理 |
| | | int currentIndex = i; |
| | | if (currentIndex == curAccountDoorLockUserList.Keys.Count - 1) |
| | | { |
| | | rowFrameLayout.LineColor = Shared.Common.ZigbeeColor.Current.XMWhite; |
| | | } |
| | | switch (curDoorLockUser.UnlockType) |
| | | { |
| | | case 0: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Password) + "ID" + curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 3: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.IcCard) + "ID" + curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | case 15: |
| | | if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) |
| | | { |
| | | btnDoorlockUser.Text = curDoorLockUser.UserName; |
| | | } |
| | | else |
| | | { |
| | | btnDoorlockUser.Text = Language.StringByID(R.MyInternationalizationString.Fingerprint) + "ID" + +curDoorLockUser.UserID; |
| | | } |
| | | break; |
| | | } |
| | | |
| | | if (curAccountObj.UserName == "" || curAccountObj.UserName == null) |
| | | { |
| | | btnMember.Text = curAccountObj.Account; |
| | | } |
| | | else |
| | | { |
| | | btnMember.Text = curAccountObj.UserName; |
| | | } |
| | | |
| | | Action<Shared.View> action = async (obj) => |
| | | { |
| | | var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | refreshDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | refreshDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | refreshDoorLockData.OpenLockMode = curDoorLockUser.UnlockType; |
| | | refreshDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | refreshDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | refreshDoorLockData.UserIdRemarks = btnDoorlockUser.Text; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | { |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | { |
| | | doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | localDoorLockObj.UnlockType = curDoorLockUser.UnlockType; |
| | | localDoorLockObj.EntryTime = curDoorLockUser.EntryTime; |
| | | localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks; |
| | | localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; |
| | | doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj); |
| | | RefreshList(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.ModigfyFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | }; |
| | | btnDoorlockUser.EditorEnterAction += action; |
| | | |
| | | btnDel.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | var alert = new Alert(Language.StringByID(R.MyInternationalizationString.Tip), Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod), |
| | | Language.StringByID(R.MyInternationalizationString.Cancel), Language.StringByID(R.MyInternationalizationString.Confrim)); |
| | | alert.Show(); |
| | | alert.ResultEventHandler += async (sender1, e1) => |
| | | { |
| | | if (e1) |
| | | { |
| | | var passData = doorLock.SetUserAccessData(curDoorLockUser.UserID, ZigBee.Device.DoorLock.AccessType.DelCurrentUser); |
| | | var resultData = await doorLock.DefaultControlAsync(passData); |
| | | if (resultData != null && resultData.defaultControlResponseData != null) |
| | | { |
| | | if (resultData.defaultControlResponseData.status == 0) |
| | | { |
| | | var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); |
| | | if (UserCenterResourse.UserInfo.AuthorityNo != 1) |
| | | { |
| | | deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); |
| | | deleteDoorLockData.IsOtherAccountCtrl = true; |
| | | } |
| | | if (doorLock.DeviceAddr != null) |
| | | { |
| | | deleteDoorLockData.DoorLockId = doorLock.DeviceAddr + "_" + doorLock.DeviceEpoint; |
| | | } |
| | | deleteDoorLockData.DoorLockLocalUserId = curDoorLockUser.UserID.ToString(); |
| | | deleteDoorLockData.PrimaryId = curDoorLockUser.PrimaryId; |
| | | deleteDoorLockData.DelDoorLockDelType = 2; |
| | | var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); |
| | | if (result != null) |
| | | { |
| | | if (result.StateCode == "Success") |
| | | { |
| | | if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) |
| | | { |
| | | doorLock.localDoorLockUserList.Remove(curDoorLockUser.UserID); |
| | | var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; |
| | | localDoorLockObj.UserID = curDoorLockUser.UserID; |
| | | doorLock.localDoorLockUserList.Remove(curUserId); |
| | | RefreshList(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (curDoorLockUser.UserID < 10) |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.OnlyBeDeletedOnTheDevice), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.CloudServerResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 1 }.Show(btnDoorlockUser); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.RemoveFailed), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | } |
| | | |
| | | } |
| | | else |
| | | { |
| | | new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.Up, CloseTime = 2 }.Show(btnDel); |
| | | } |
| | | } |
| | | }; |
| | | }; |
| | | #endregion |
| | | i++; |
| | | } |
| | | |
| | | bodyView.Height = i * Application.GetRealHeight(127 + 23); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | ZbGateway.StatusList.Remove(this); |
| | | base.RemoveFromParent(); |
| | | } |
| | | |
| | | |
| | | |
| | | public void Changed(CommonDevice common) |
| | | { |