From 0d9f64668fd7350d6a21fd157e32009a96d98134 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期三, 16 十二月 2020 13:09:08 +0800 Subject: [PATCH] 新云端代码Ver1.2 --- ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs | 345 +++------------------------------------------------------ 1 files changed, 18 insertions(+), 327 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs index 41565af..29c1290 100755 --- a/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/DoorLock/DoorLockCommonLayout.cs @@ -16,14 +16,6 @@ #region 鍙橀噺鐢虫槑 public new FrameLayout topFrameLayout = new FrameLayout { Height = Application.GetRealHeight(184), BackgroundColor = ZigbeeColor.Current.XMTopFrameLayout }; public FrameLayout midFrameLayout = new FrameLayout { Height = Application.GetRealHeight(1925 - 184), BackgroundColor = ZigbeeColor.Current.XMMidFrameLayout }; - /// <summary> - /// 閫変腑鐨勫紑閿佹柟寮忓洖璋� - /// </summary> - public Action<string> ChooseUnlockMethodAction = null; - /// <summary> - /// 閫変腑鐨勫紑閿佹柟寮忓洖璋� - /// </summary> - public Action<int> UndateUnlockMethodAction = null; #region 搴曢儴鏈夊渾瑙掑竷灞� /// 鑳屾櫙闃村奖鐣岄潰 /// </summary> @@ -304,7 +296,7 @@ { btnNext.IsSelected = true; } - if (!UserCenterResourse.AccountOption.DoorUnLockByRemote) + if (!HdlUserCenterResourse.AccountOption.DoorUnLockByRemote) { string msg = Language.StringByID(R.MyInternationalizationString.RemoteUnlockBindSucessTip).Replace("{0}", "\r\n"); var alert = new ShowDoorLockMsgControl(ShowDoorLockMsgControl.DoorLockMsgType.Confirm, msg, Language.StringByID(R.MyInternationalizationString.GoSetting)); @@ -425,7 +417,7 @@ return; } - if (!UserCenterResourse.AccountOption.DoorUnLockByRemote) + if (!HdlUserCenterResourse.AccountOption.DoorUnLockByRemote) { SystemSecondAuthentication(); return; @@ -584,332 +576,31 @@ /// <param name="curIndex"></param> /// <param name="btnAllMethod"></param> /// <param name="btnMethodText"></param> - public void DisplayAllUnlockMethod(ZigBee.Device.DoorLock doorLock, int curIndex, Button btnAllMethod, Button btnMethodText) + public void DisplayAllUnlockMethod(int curIndex, Button btnAllMethod, Button btnMethodText) { - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(doorLock.DeviceAddr); - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); - if (curIndex == 0) + switch (curIndex) { - btnAllMethod.UnSelectedImagePath = "DoorLock/AllMethod.png"; - btnAllMethod.SelectedImagePath = "DoorLock/AllMethodOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.AllMethod); - } - else if (curIndex == 1) - { - btnAllMethod.UnSelectedImagePath = "DoorLock/Password.png"; - btnAllMethod.SelectedImagePath = "DoorLock/PasswordOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.PasswordUnlock); - } - else if (curIndex == 2) - { - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1F) - { - btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; - btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock); - } - else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_HAT1B) - { - btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; - btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock); - } - else - { + 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); - } - } - else if (curIndex == 3) - { - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1F) - { - btnAllMethod.UnSelectedImagePath = "DoorLock/faceId.png"; - btnAllMethod.SelectedImagePath = "DoorLock/faceIdOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock); - } - else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1TF) - { + break; + case 3: btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png"; btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png"; btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); - } - else - { - btnAllMethod.UnSelectedImagePath = "DoorLock/proximityCard.png"; - btnAllMethod.SelectedImagePath = "DoorLock/proximityCardOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock); - } + break; } - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1TF) - { - if (curIndex == 4) - { - btnAllMethod.UnSelectedImagePath = "DoorLock/faceId.png"; - btnAllMethod.SelectedImagePath = "DoorLock/faceIdOn.png"; - btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock); - } - } - - - - //switch (curIndex) - //{ - // 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; - // case 4: - // btnAllMethod.UnSelectedImagePath = "DoorLock/faceId.png"; - // btnAllMethod.SelectedImagePath = "DoorLock/faceIdOn.png"; - // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.FaceIDUnlock); - // break; - // case 5: - // btnAllMethod.UnSelectedImagePath = "DoorLock/Fingerprint.png"; - // btnAllMethod.SelectedImagePath = "DoorLock/FingerprintOn.png"; - // btnMethodText.Text = Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock); - // break; - //} - } - - /// <summary> - /// 渚ц竟瀵艰埅鏍� - /// </summary> - public void SideslipFramelayout(ZigBee.Device.DoorLock doorLock) - { - #region sidelipFrameLayout UI - var dialog = new Dialog - { - }; - dialog.Show(); - - var flMain = new FrameLayout { BackgroundColor = 0x00000000 }; - dialog.AddChidren(flMain); - flMain.MouseUpEventHandler += (sender11, e11) => - { - dialog.Close(); - }; - - var sidelipFrameLayout = new FrameLayout() - { - Width = Application.GetRealWidth(449), - Y = Application.GetRealHeight(115 + 160), - X = Application.GetRealWidth(596), - BackgroundImagePath = "DoorLock/SideslipPic.png", - }; - flMain.AddChidren(sidelipFrameLayout); - - var sidelipVerticalScrolViewLayout = new VerticalScrolViewLayout() - { - Y = Application.GetRealHeight(28), - }; - sidelipFrameLayout.AddChidren(sidelipVerticalScrolViewLayout); - #endregion - - Button oldbutton = null; - Button oldbuttonText = null; - int count = 1 + GetSupportType(doorLock); - sidelipFrameLayout.Height = Application.GetRealHeight(150) * count + Application.GetRealHeight(6); - sidelipVerticalScrolViewLayout.Height = Application.GetRealHeight(150) * count + Application.GetRealHeight(6); - for (var i = 0; i < count; i++) - { - #region rowFrameLayout UI - var rowFrameLayout = new FrameLayout() - { - Height = Application.GetRealHeight(150), - X = Application.GetRealWidth(81), - }; - sidelipVerticalScrolViewLayout.AddChidren(rowFrameLayout); - - var btnAllMethod = new Button() - { - Width = Application.GetRealWidth(81), - Height = Application.GetRealHeight(81), - Y = Application.GetRealHeight(35), - }; - rowFrameLayout.AddChidren(btnAllMethod); - - var btnMethodText = new Button() - { - Width = Application.GetRealWidth(311), - Height = Application.GetRealHeight(58), - X = Application.GetRealWidth(92), - Y = Application.GetRealHeight(49), - TextColor = Shared.Common.ZigbeeColor.Current.XMGray3, - TextSize = 14, - TextAlignment = TextAlignment.CenterLeft, - }; - rowFrameLayout.AddChidren(btnMethodText); - - var line2 = new Button() - { - Y = rowFrameLayout.Height - 1, - X = Application.GetRealWidth(81), - Width = Application.GetRealWidth(965), - Height = 1, - BackgroundColor = Shared.Common.ZigbeeColor.Current.XMRowLine, - }; - rowFrameLayout.AddChidren(line2); - if (i == count) - { - line2.Visible = false; - } - #endregion - - #region 鏁版嵁澶勭悊 - EventHandler<MouseEventArgs> hander = (sender, e) => - { - if (!btnAllMethod.IsSelected) - { - if (oldbutton != null) - { - oldbutton.IsSelected = false; - } - if (oldbuttonText != null) - { - oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMGray3; - } - oldbutton = btnAllMethod; - oldbuttonText = btnMethodText; - - doorLock.ReSave(); - btnAllMethod.IsSelected = true; - oldbuttonText.TextColor = Shared.Common.ZigbeeColor.Current.XMBlack; - oldbuttonText.IsBold = true; - doorLock.currentUserDisplayMethod = btnMethodText.Text; - TypeRefresh(doorLock); - } - dialog.Close(); - }; - rowFrameLayout.MouseUpEventHandler += hander; - btnAllMethod.MouseUpEventHandler += hander; - btnMethodText.MouseUpEventHandler += hander; - - DisplayAllUnlockMethod(doorLock, i, btnAllMethod, btnMethodText); - - if (string.IsNullOrEmpty(doorLock.currentUserDisplayMethod) && i == 0) - { - CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); - } - if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.AllMethod) && i == 0) - { - CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); - } - if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock) && i == 1) - { - CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); - } - if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock) && i == 2) - { - CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); - } - if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock) && i == 3) - { - CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); - } - if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FaceIDUnlock) && i == 4) - { - CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); - } - if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock) && i == 5) - { - CurrentSelectUnlockMethod(btnAllMethod, btnMethodText, oldbutton, oldbuttonText); - } - #endregion - } - } - - /// <summary> - /// 褰撳墠闂ㄩ攣鏀寔鐨勫紑閿佺被鍨嬩釜鏁� - /// </summary> - /// <param name="doorLock"></param> - /// <returns></returns> - public int GetSupportType(ZigBee.Device.DoorLock doorLock) - { - int count = 0; - var listDevice = Common.LocalDevice.Current.GetDevicesByMac(doorLock.DeviceAddr); - var deviceEnumInfo = Common.LocalDevice.Current.GetMyDeviceEnumInfo(listDevice); - if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1F) - { - //AT1F鏈夊瘑鐮侊紝鎰熷簲鍗★紝faceID - count = 3; - } - else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1T) - { - //AT1T鏈夊瘑鐮侊紝鎸囩汗锛屾劅搴斿崱 - count = 3; - } - else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_AT1TF) - { - //AT1TF鏈夊瘑鐮侊紝鎸囩汗锛屾劅搴斿崱,faceID - count = 4; - } - else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_HAT1B) - { - //HAT1B瀵嗙爜銆侀潤鑴夌汗銆佸埛鍗� - count = 3; - } - else if (deviceEnumInfo.ConcreteType == Common.DeviceConcreteType.IntelligentLocks_HAT1T) - { - //HAT1T瀵嗙爜銆佹寚绾广�佸埛鍗� - count = 3; - } - else - { - //鍙湁瀵嗙爜锛屾寚绾癸紝鎰熷簲鍗� - count = 3; - } - return count; - } - - /// <summary> - /// 绫诲瀷鍖哄垎 - /// </summary> - public void TypeRefresh(ZigBee.Device.DoorLock doorLock) - { - if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.PasswordUnlock)) - { - UndateUnlockMethodAction?.Invoke(0); - } - else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.ProximithCardUnlock)) - { - UndateUnlockMethodAction?.Invoke(3); - } - else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.CalmFingerprintUnlock)) - { - UndateUnlockMethodAction?.Invoke(13); - } - else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FaceIDUnlock)) - { - UndateUnlockMethodAction?.Invoke(14); - } - else if (doorLock.currentUserDisplayMethod == Language.StringByID(R.MyInternationalizationString.FingerprintUnlock)) - { - UndateUnlockMethodAction?.Invoke(15); - } - else - { - UndateUnlockMethodAction?.Invoke(-1); - } - //姣忔璋冨畬娓呯┖ - UndateUnlockMethodAction = null; } #region 鈻� 涓�鑸柟娉昣__________________________ -- Gitblit v1.8.0