From 9f326f4000847e6167d8166fa2f6a66f53cb3734 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期四, 17 十二月 2020 09:07:13 +0800 Subject: [PATCH] 新云端Ver1.3 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs | 275 +++++++++++++++++++++++++++--------------------------- 1 files changed, 136 insertions(+), 139 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs index 39c4f52..b51f2a7 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/UnLockMethod.cs @@ -33,23 +33,50 @@ /// 鏋勯�犲嚱鏁� /// </summary> /// <param name="doorLock"></param> - public UnLockMethod(ZigBee.Device.DoorLock doorLock, Shared.Phone.UserCenter.MemberInfoRes accountObj) + public UnLockMethod(ZigBee.Device.DoorLock doorLock, MemberInfoRes accountObj) { this.doorLock = doorLock; this.curAccountObj = accountObj; BackgroundColor = Shared.Common.ZigbeeColor.Current.GXCTopViewBackgroundColor; } - #region 鈼� 鍙橀噺鐢虫槑__________________________ - ZigBee.Device.DoorLock doorLock;//褰撳墠闂ㄩ攣 - VerticalListRefreshControl bodyView;//鍒锋柊View - Button currentMethod;// 褰撳墠閫夋嫨鐨勬柟寮� - Shared.Phone.UserCenter.MemberInfoRes curAccountObj;//褰撳墠璐︽埛 + #region 鍙橀噺鐢虫槑 + /// <summary> + /// 褰撳墠闂ㄩ攣 + /// </summary> + ZigBee.Device.DoorLock doorLock; + /// <summary> + /// 鍒锋柊View + /// </summary> + VerticalListRefreshControl bodyView; + /// <summary> + /// 褰撳墠閫夋嫨鐨勬柟寮� + /// </summary> + Button currentMethod; + /// <summary> + /// 褰撳墠璐︽埛 + /// </summary> + MemberInfoRes curAccountObj; + /// <summary> + /// 鏁版嵁涓虹┖锛孶I鏄剧ず鐨勭┖鍥剧墖 + /// </summary> Button entryStatusPic; + /// <summary> + /// 鏁版嵁涓虹┖锛孶I鏄剧ず鐨勬枃鏈彁绀� + /// </summary> Button btnPicTip; + /// <summary> + /// 鏁版嵁涓虹┖锛孶I鏄剧ず鐨勬枃鏈彁绀� + /// </summary> Button btnPicTip1; - bool isSecondDel;//鏄惁浜屾鍒犻櫎 - FrameLayout blankFrameLayout;//绌烘暟鎹樉绀哄竷灞� + /// <summary> + /// //鏄惁浜屾鍒犻櫎 + /// </summary> + bool isSecondDel; + /// <summary> + /// 绌烘暟鎹樉绀哄竷灞� + /// </summary> + FrameLayout blankFrameLayout; #endregion /// <summary> @@ -61,15 +88,16 @@ { try { - var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); - if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) - { - //鏁版嵁濡傛灉鍦ㄩ棬閿佷笂闈㈡槸绌虹殑鏃跺�欙紝鏁版嵁涔熸槸娌℃湁鐨� - Application.RunOnMainThread(() => - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); - }); - } + //鈽嗐優銉笺偗鈽� + //var list = await Shared.Phone.UserCenter.DoorLock.DoorLockCommonInfo.GetDoorLockAllAcountUserlist(doorLock); + //if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) + //{ + // //鏁版嵁濡傛灉鍦ㄩ棬閿佷笂闈㈡槸绌虹殑鏃跺�欙紝鏁版嵁涔熸槸娌℃湁鐨� + // Application.RunOnMainThread(() => + // { + // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.GwResponseOvertime), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); + // }); + //} } catch { } finally @@ -85,11 +113,12 @@ }); } - /// <summary> - /// UI鏄剧ず + /// <summary> + /// UI鏄剧ず /// </summary> public void Show() { + UserView.HomePage.Instance.ScrollEnabled = false; doorLock.currentUserDisplayMethod = ""; this.TopFrameLayout(this, Language.StringByID(R.MyInternationalizationString.LockMethod)); this.btnTitleLine.Visible = false; @@ -116,25 +145,26 @@ UnSelectedImagePath = "DoorLock/AddIcon.png", }; btnAddFrameLayout.AddChidren(btnAdd); - if (UserCenterResourse.UserInfo.AuthorityNo != 1) + if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) { btnAdd.Width = 0; } btnAdd.MouseDownEventHandler += (sender, e) => { - if (doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] == true) - { - new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); - } - else - { - var addUnLockMethod = new Shared.Phone.UserCenter.DoorLock.AddUnLockMethod(doorLock, curAccountObj); - Shared.Phone.UserView.HomePage.Instance.AddChidren(addUnLockMethod); - Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; - addUnLockMethod.Show(); - } + //鈽嗐優銉笺偗鈽� + //if (doorLock.IsFreezeAccount[curAccountObj.SubAccountDistributedMark] == true) + //{ + // new Tip() { MaxWidth = 150, Text = Language.StringByID(R.MyInternationalizationString.AccountIsFreezed), Direction = AMPopTipDirection.None, CloseTime = 1 }.Show(Common.CommonPage.Instance); + //} + //else + //{ + // var addUnLockMethod = new Shared.Phone.UserCenter.DoorLock.AddUnLockMethod(doorLock, curAccountObj); + // Shared.Phone.UserView.HomePage.Instance.AddChidren(addUnLockMethod); + // Shared.Phone.UserView.HomePage.Instance.PageIndex += 1; + // addUnLockMethod.Show(); + //} }; - if (UserCenterResourse.UserInfo.AuthorityNo == 3) + if (HdlUserCenterResourse.ResidenceOption.AuthorityNo == 3) { btnAddFrameLayout.Width = 0; } @@ -144,17 +174,21 @@ } MidFrameLayoutContent(); - if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) - { - CommonPage.Loading.Start("Loading..."); - ReadDoorLockUserInfo(); - } - else - { - RefreshList(); - } + //鈽嗐優銉笺偗鈽� + //if (doorLock.IsFailedToGetDoorLockInfo[curAccountObj.SubAccountDistributedMark] == true) + //{ + // CommonPage.Loading.Start("Loading..."); + // ReadDoorLockUserInfo(); + //} + //else + //{ + // RefreshList(); + //} } - //涓儴甯冨眬 + + /// <summary> + /// 涓儴甯冨眬 + /// </summary> void MidFrameLayoutContent() { #region 寮�閿佹柟寮廢I @@ -210,10 +244,12 @@ }; midTopFrameLayout.AddChidren(btnNext); - btnNext.MouseUpEventHandler += (sender, e) => + EventHandler<MouseEventArgs> handerSideLip = (sender, e) => { SideslipFramelayout(); }; + btnNext.MouseUpEventHandler += handerSideLip; + btnAllMethod.MouseUpEventHandler += handerSideLip; var btnLine = new Button { Y = midTopFrameLayout.Bottom, @@ -255,6 +291,7 @@ Width = Application.GetRealHeight(757), Visible = false, UnSelectedImagePath = "DoorLock/UnLockBlankPic.png", + Gravity = Gravity.CenterHorizontal, }; blankFrameLayout.AddChidren(entryStatusPic); @@ -281,6 +318,10 @@ TextSize = 12, }; blankFrameLayout.AddChidren(btnPicTip1); + if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) + { + btnPicTip1.Width = 0; + } } /// <summary> @@ -297,15 +338,15 @@ foreach (var curUserId in doorLock.localDoorLockUserList.Keys) { var curDoorLockUser = doorLock.localDoorLockUserList[curUserId]; - - if (curDoorLockUser.ConnectedAccount == "" || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) - { - continue; - } - else - { - curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser); - } + //鈽嗐優銉笺偗鈽� + //if (string.IsNullOrEmpty(curDoorLockUser.ConnectedAccount) || curDoorLockUser.ConnectedAccount != curAccountObj.SubAccountDistributedMark) + //{ + // continue; + //} + //else + //{ + // curAccountDoorLockUserList.Add(curDoorLockUser.UserID, curDoorLockUser); + //} } if (curAccountDoorLockUserList.Count == 0) @@ -360,8 +401,7 @@ break; } - #region UI - + #region UI var rowFrameLayout = new RowLayoutControl(bodyView.rowSpace / 2); rowFrameLayout.BackgroundColor = ZigbeeColor.Current.XMWhite; bodyView.AddChidren(rowFrameLayout); @@ -369,15 +409,8 @@ var btnicon = rowFrameLayout.frameTable.AddLeftIcon(); btnicon.UnSelectedImagePath = "DoorLock/DoorLockUserPic.png"; //涓婇潰闂ㄩ攣鐢ㄦ埛鍚嶇О涓�琛� - var memberText = ""; - if (curAccountObj.UserName == "" || curAccountObj.UserName == null) - { - memberText = curAccountObj.Account; - } - else - { - memberText = curAccountObj.UserName; - } + var memberText = curAccountObj.ShowName; + //鎴愬憳涓�琛� var btnaa = rowFrameLayout.frameTable.AddBottomView(memberText, 800); var btnDoorlockUser = new EditText() @@ -397,7 +430,7 @@ btndelete.ButtonClickEvent += (sender, e) => { string msg = Language.StringByID(R.MyInternationalizationString.SureToDelUnlockMethod); - var alert = new Shared.Phone.UserCenter.ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm)); + var alert = new ShowMsgControl(ShowMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.DoorlockConfirm)); alert.Show(); //浣跨敤纭鍨嬪脊妗嗘椂,鐨勫洖璋冨嚱鏁� alert.ConfirmClickEvent += async () => @@ -412,9 +445,10 @@ if (resultData.defaultControlResponseData.status == 0 || resultData.defaultControlResponseData.status == 2) { var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); - if (UserCenterResourse.UserInfo.AuthorityNo != 1) + if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) { - deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); + //鈽嗐優銉笺偗鈽� + //deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); deleteDoorLockData.IsOtherAccountCtrl = true; } if (doorLock.DeviceAddr != null) @@ -427,7 +461,7 @@ var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); if (result != null) { - if (result.StateCode == "Success") + if (result.Code == HttpMessageEnum.A鎴愬姛) { isSecondDel = false; if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) @@ -457,9 +491,10 @@ if (isSecondDel) { var deleteDoorLockData = new ZigBee.Device.DoorLock.DeleteDoorLockData(); - if (UserCenterResourse.UserInfo.AuthorityNo != 1) + if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) { - deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); + //鈽嗐優銉笺偗鈽� + //deleteDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); deleteDoorLockData.IsOtherAccountCtrl = true; } if (doorLock.DeviceAddr != null) @@ -472,7 +507,7 @@ var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/DelDoorLock", deleteDoorLockData); if (result != null) { - if (result.StateCode == "Success") + if (result.Code == HttpMessageEnum.A鎴愬姛) { isSecondDel = false; if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) @@ -532,7 +567,7 @@ switch (curDoorLockUser.UnlockType) { case 0: - if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) + if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) { btnDoorlockUser.Text = curDoorLockUser.UserName; } @@ -542,7 +577,7 @@ } break; case 3: - if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) + if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) { btnDoorlockUser.Text = curDoorLockUser.UserName; } @@ -552,7 +587,7 @@ } break; case 15: - if (curDoorLockUser.UserName != "" && curDoorLockUser.UserName != null) + if (!string.IsNullOrEmpty(curDoorLockUser.UserName)) { btnDoorlockUser.Text = curDoorLockUser.UserName; } @@ -567,9 +602,10 @@ Action<Shared.View> action = async (obj) => { var refreshDoorLockData = new ZigBee.Device.DoorLock.RefreshDoorLockData(); - if (UserCenterResourse.UserInfo.AuthorityNo != 1) + if (HdlUserCenterResourse.ResidenceOption.AuthorityNo != 1) { - refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); + //鈽嗐優銉笺偗鈽� + //refreshDoorLockData.LoginAccessToken = UserCenterLogic.GetConnectMainToken(); refreshDoorLockData.IsOtherAccountCtrl = true; } if (doorLock.DeviceAddr != null) @@ -583,7 +619,7 @@ var result = await ZigBee.Device.DoorLock.SendDoorLockToServer("DoorLock/UpdateDoorLock", refreshDoorLockData); if (result != null) { - if (result.StateCode == "Success") + if (result.Code == HttpMessageEnum.A鎴愬姛) { if (doorLock.localDoorLockUserList.ContainsKey(curDoorLockUser.UserID)) { @@ -591,9 +627,11 @@ var localDoorLockObj = new ZigBee.Device.DoorLock.LocaDoorLockObj() { }; localDoorLockObj.UserID = curDoorLockUser.UserID; localDoorLockObj.UnlockType = curDoorLockUser.UnlockType; + localDoorLockObj.PrimaryId = curDoorLockUser.PrimaryId; localDoorLockObj.EntryTime = curDoorLockUser.EntryTime; localDoorLockObj.UserName = refreshDoorLockData.UserIdRemarks; - localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; + //鈽嗐優銉笺偗鈽� + //localDoorLockObj.ConnectedAccount = curAccountObj.SubAccountDistributedMark; doorLock.localDoorLockUserList.Add(curDoorLockUser.UserID, localDoorLockObj); TypeRefresh(); } @@ -615,9 +653,12 @@ } } - // 渚ц竟瀵艰埅鏍� + /// <summary> + /// 渚ц竟瀵艰埅鏍� + /// </summary> void SideslipFramelayout() { + #region sidelipFrameLayout UI var dialog = new Dialog { }; @@ -646,10 +687,13 @@ Y = Application.GetRealHeight(28), }; sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); + #endregion + Button oldbutton = null; Button oldbuttonText = null; for (var i = 0; i < 4; i++) { + #region rowFrameLayout UI var rowFrameLayout = new RowLayout() { Height = Application.GetRealHeight(150), @@ -677,7 +721,9 @@ TextAlignment = TextAlignment.CenterLeft, }; rowFrameLayout.AddChidren(btnMethodText); + #endregion + #region 鏁版嵁澶勭悊 EventHandler<MouseEventArgs> hander = (sender, e) => { if (!btnAllMethod.IsSelected) @@ -705,74 +751,35 @@ btnAllMethod.MouseUpEventHandler += hander; btnMethodText.MouseUpEventHandler += hander; - switch (i) - { - case 0: - btnAllMethod.UnSelectedImagePath = "DoorLock/AllMethod.png"; - btnAllMethod.SelectedImagePath = "DoorLock/AllMethodOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); - break; - case 1: - btnAllMethod.UnSelectedImagePath = "DoorLock/Password.png"; - btnAllMethod.SelectedImagePath = "DoorLock/PasswordOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock); - break; - case 2: - btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; - btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FingerprintUnlock); - break; - case 3: - btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png"; - btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); - break; - } + DisplayAllUnlockMethod(i, btnAllMethod, btnMethodText); - if (doorLock.currentUserDisplayMethod == "" && i == 0) + if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0) { - btnAllMethod.IsSelected = true; - btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - btnMethodText.IsBold = true; - oldbutton = btnAllMethod; - oldbuttonText = btnMethodText; + CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); } if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0) { - btnAllMethod.IsSelected = true; - btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - btnMethodText.IsBold = true; - oldbutton = btnAllMethod; - oldbuttonText = btnMethodText; + CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); } if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1) { - btnAllMethod.IsSelected = true; - btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - btnMethodText.IsBold = true; - oldbutton = btnAllMethod; - oldbuttonText = btnMethodText; + CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); } if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2) { - btnAllMethod.IsSelected = true; - btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - btnMethodText.IsBold = true; - oldbutton = btnAllMethod; - oldbuttonText = btnMethodText; + CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); } if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3) { - btnAllMethod.IsSelected = true; - btnMethodText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - btnMethodText.IsBold = true; - oldbutton = btnAllMethod; - oldbuttonText = btnMethodText; + CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); } + #endregion } } - //绫诲瀷鍖哄垎 + /// <summary> + /// 绫诲瀷鍖哄垎 + /// </summary> void TypeRefresh() { if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) @@ -798,19 +805,9 @@ /// </summary> public override void RemoveFromParent() { + UserView.HomePage.Instance.ScrollEnabled = true; ZbGateway.StatusList.Remove(this); base.RemoveFromParent(); - } - - public void Changed(CommonDevice common) - { - } - public void ChangedILogicStatus(ZigBee.Device.Logic logic) - { - } - - public void ChangedISceneStatus(Scene scene) - { } } } -- Gitblit v1.8.0