From 611786df5108dca0bdcff03834cc285cba4b8e61 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 13 十月 2020 16:48:43 +0800 Subject: [PATCH] 2020-10-13-1 --- HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs | 320 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 275 insertions(+), 45 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs index 2e1b448..31f34f9 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs @@ -5,10 +5,20 @@ { public partial class AppUnlockSettingsPage { + Action refreshAction; void LoadEventList() { LoadEvent_OptionChange(); LoadEvent_InitOptionState(); + + refreshAction = () => + { + LoadView_UnlockView(); + //fingerprintUnlockDiv.Visible = sTouchID && (MainPage.LoginUser.appUnlockType.Contains("1") || MainPage.LoginUser.appUnlockType.Contains("2")); + //faceIdUnlockDiv.Visible = sFaceID && (MainPage.LoginUser.appUnlockType.Contains("1") || MainPage.LoginUser.appUnlockType.Contains("2")); + //btnFingerprintUnlockSwtichIcon.IsSelected = MainPage.LoginUser.appUnlockType.Contains("3"); + //btnFaceIdUnlockSwtichIcon.IsSelected = MainPage.LoginUser.appUnlockType.Contains("4"); + }; } /// <summary> @@ -16,82 +26,211 @@ /// </summary> void LoadEvent_OptionChange() { - EventHandler< MouseEventArgs> eventHandler1 = (sender, e) => { - btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; - btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = false; - btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = false; - btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = false; + EventHandler<MouseEventArgs> eventHandler1 = (sender, e1) => + { + Action action = () => + { + btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; + btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = false; + btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = false; + btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = false; - btnTipMsg.TextID = StringId.UnprotectedTipMsg; - btnTipMsg.Visible = true; + btnTipMsg.TextID = StringId.UnprotectedTipMsg; - MainPage.LoginUser.appUnlock = new System.Collections.Generic.List<string>(); - MainPage.LoginUser.SaveUserInfo(); + MainPage.LoginUser.appUnlockPage = new System.Collections.Generic.List<string>(); + MainPage.LoginUser.appUnlockType = new System.Collections.Generic.List<string>(); + MainPage.LoginUser.appUnlockPasswrod = ""; + MainPage.LoginUser.SaveUserInfo(); + unlockOptionView.Visible = false; + refreshAction(); + }; + Action action1 = () => { + if (!btnUnprotectedBg.IsSelected) + { + //1:楠岃瘉鎸囩汗 + if (MainPage.LoginUser.appUnlockType.Contains("3")) + { + TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint)); + TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) => + { + if (e == TouchIDUtils.TouchIDState.NotSupport) + { + MainPage.Log("KK:褰撳墠璁惧涓嶆敮鎸乀ouchID楠岃瘉,璇疯緭鍏ュ瘑鐮佹潵楠岃瘉"); + } + else if (e == TouchIDUtils.TouchIDState.Success) + { + MainPage.Log("KK:TouchID楠岃瘉鎴愬姛"); + action(); + } + else if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout) + { + MainPage.Log("KK:鐢ㄦ埛閫夋嫨鎵嬪姩杈撳叆瀵嗙爜"); + if (MainPage.LoginUser.appUnlockType.Contains("1")) + { + var page = new AppUnlockPasswordPage(MainPage.LoginUser.appUnlockPasswrod, action); + MainPage.BasePageView.AddChidren(page); + page.LoadPage("4"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else if (MainPage.LoginUser.appUnlockType.Contains("1")) + { + var page = new AppUnlockGesturePage(MainPage.LoginUser.appUnlockPasswrod, action); + MainPage.BasePageView.AddChidren(page); + page.LoadPage("4"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + } + }; + } + else if (MainPage.LoginUser.appUnlockType.Contains("4")) + { + //Face ID楠岃瘉 + // + } + else if (MainPage.LoginUser.appUnlockType.Contains("1")) + { + var page = new AppUnlockPasswordPage(MainPage.LoginUser.appUnlockPasswrod, action); + MainPage.BasePageView.AddChidren(page); + page.LoadPage("4"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else if (MainPage.LoginUser.appUnlockType.Contains("2")) + { + var page = new AppUnlockGesturePage(MainPage.LoginUser.appUnlockPasswrod, action); + MainPage.BasePageView.AddChidren(page); + page.LoadPage("4"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + } + }; + if (MainPage.LoginUser.appUnlockPasswrod != "") + { + new PublicAssmebly().TipMsg(StringId.Tip, StringId.TipTurnOffUnlockingSetting, action1); + } + else + { + action(); + } }; btnUnprotectedBg.MouseUpEventHandler = eventHandler1; btnUnprotectedSelectionIcon.MouseUpEventHandler = eventHandler1; btnUnprotectedSelectionTip.MouseUpEventHandler = eventHandler1; - - EventHandler<MouseEventArgs> eventHandler2 = (sender, e) => { - btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; - btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = true; + EventHandler<MouseEventArgs> eventHandler2 = (sender, e) => + { + bool result = !btnStartupBg.IsSelected; + btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = result; btnTipMsg.Text = Language.StringByID(StringId.AtStartupTipMsg); - btnTipMsg.Visible = true; - - if (!MainPage.LoginUser.appUnlock.Contains("1")) + if (result) { - MainPage.LoginUser.appUnlock.Add("1"); + btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; + if (!MainPage.LoginUser.appUnlockPage.Contains("1")) + { + MainPage.LoginUser.appUnlockPage.Add("1"); + if (MainPage.LoginUser.appUnlockPasswrod != "") + MainPage.LoginUser.SaveUserInfo(); + } + unlockOptionView.Visible = true; + } + else + { + if (MainPage.LoginUser.appUnlockPage.Contains("1")) + { + MainPage.LoginUser.appUnlockPage.Remove("1"); + } + if (MainPage.LoginUser.appUnlockPage.Count == 0) + { + btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; + btnTipMsg.TextID = StringId.UnprotectedTipMsg; + MainPage.LoginUser.appUnlockPasswrod = ""; + unlockOptionView.Visible = false; + refreshAction(); + } MainPage.LoginUser.SaveUserInfo(); } - }; btnStartupBg.MouseUpEventHandler = eventHandler2; btnStartupSelectionIcon.MouseUpEventHandler = eventHandler2; btnStartupSelectionTip.MouseUpEventHandler = eventHandler2; - - EventHandler<MouseEventArgs> eventHandler3 = (sender, e) => { - btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; - btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true; + EventHandler<MouseEventArgs> eventHandler3 = (sender, e) => + { + bool result = !btnSecurityBg.IsSelected; + btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = result; btnTipMsg.Text = Language.StringByID(StringId.DefenseAndUndefenseTipMsg); - btnTipMsg.Visible = true; - if (!MainPage.LoginUser.appUnlock.Contains("2")) + if (result) { - MainPage.LoginUser.appUnlock.Add("2"); + btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; + if (!MainPage.LoginUser.appUnlockPage.Contains("2")) + { + MainPage.LoginUser.appUnlockPage.Add("2"); + if (MainPage.LoginUser.appUnlockPasswrod != "") + MainPage.LoginUser.SaveUserInfo(); + } + unlockOptionView.Visible = true; + } + else + { + if (MainPage.LoginUser.appUnlockPage.Contains("2")) + { + MainPage.LoginUser.appUnlockPage.Remove("2"); + } + if (MainPage.LoginUser.appUnlockPage.Count == 0) + { + btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = result; + btnTipMsg.TextID = StringId.UnprotectedTipMsg; + MainPage.LoginUser.appUnlockPasswrod = ""; + unlockOptionView.Visible = false; + refreshAction(); + } MainPage.LoginUser.SaveUserInfo(); } - }; btnSecurityBg.MouseUpEventHandler = eventHandler3; btnSecuritySelectionIcon.MouseUpEventHandler = eventHandler3; btnSecuritySelectionTip.MouseUpEventHandler = eventHandler3; - - EventHandler<MouseEventArgs> eventHandler4 = (sender, e) => { - btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; - btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true; + EventHandler<MouseEventArgs> eventHandler4 = (sender, e) => + { + bool result = !btnDoorlockBg.IsSelected; + btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = result; btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg); - btnTipMsg.Visible = true; - - if (!MainPage.LoginUser.appUnlock.Contains("3")) + if (result) { - MainPage.LoginUser.appUnlock.Add("3"); + btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false; + if (!MainPage.LoginUser.appUnlockPage.Contains("3")) + { + MainPage.LoginUser.appUnlockPage.Add("3"); + if (MainPage.LoginUser.appUnlockPasswrod != "") + MainPage.LoginUser.SaveUserInfo(); + } + unlockOptionView.Visible = true; + } + else + { + if (MainPage.LoginUser.appUnlockPage.Contains("3")) + { + MainPage.LoginUser.appUnlockPage.Remove("3"); + } + if (MainPage.LoginUser.appUnlockPage.Count == 0) + { + btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; + btnTipMsg.TextID = StringId.UnprotectedTipMsg; + MainPage.LoginUser.appUnlockPasswrod = ""; + unlockOptionView.Visible = false; + refreshAction(); + } MainPage.LoginUser.SaveUserInfo(); } - }; btnDoorlockBg.MouseUpEventHandler = eventHandler4; btnDoorlockSelectionIcon.MouseUpEventHandler = eventHandler4; btnDoorlockSelectionTip.MouseUpEventHandler = eventHandler4; - - - } /// <summary> @@ -99,23 +238,26 @@ /// </summary> void LoadEvent_InitOptionState() { - if (MainPage.LoginUser.appUnlock.Count == 0) + if (MainPage.LoginUser.appUnlockPage.Count == 0) { btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true; } else { - if (MainPage.LoginUser.appUnlock.Contains("1")) + if (MainPage.LoginUser.appUnlockPage.Contains("1")) { btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = true; + btnTipMsg.Text = Language.StringByID(StringId.AtStartupTipMsg); } - if (MainPage.LoginUser.appUnlock.Contains("2")) + if (MainPage.LoginUser.appUnlockPage.Contains("2")) { btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true; + btnTipMsg.Text = Language.StringByID(StringId.DefenseAndUndefenseTipMsg); } - if (MainPage.LoginUser.appUnlock.Contains("3")) + if (MainPage.LoginUser.appUnlockPage.Contains("3")) { btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true; + btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg); } } } @@ -127,11 +269,99 @@ { btnPasswordUnlockTitle.MouseUpEventHandler = (sender, e) => { - var page = new AppUnlockPasswordSettingPage(MainPage.LoginUser.appUnlockPasswrod); + var page = new AppUnlockPasswordPage(MainPage.LoginUser.appUnlockPasswrod, refreshAction); MainPage.BasePageView.AddChidren(page); - page.LoadPage(); + page.LoadPage(MainPage.LoginUser.appUnlockType.Contains("1") ? "3" : "1"); MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; }; + + btnResetPasswordTitle.MouseUpEventHandler = (sender, e) => + { + var page = new AppUnlockPasswordPage(MainPage.LoginUser.appUnlockPasswrod, refreshAction); + MainPage.BasePageView.AddChidren(page); + page.LoadPage("2"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + btnGestureUnlockTitle.MouseUpEventHandler = (sender, e) => + { + var page = new AppUnlockGesturePage(MainPage.LoginUser.appUnlockPasswrod, refreshAction); + MainPage.BasePageView.AddChidren(page); + page.LoadPage(MainPage.LoginUser.appUnlockType.Contains("2") ? "3" : "1"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + btnResetGestureTitle.MouseUpEventHandler = (sender, e) => + { + var page = new AppUnlockGesturePage(MainPage.LoginUser.appUnlockPasswrod, refreshAction); + MainPage.BasePageView.AddChidren(page); + page.LoadPage("3"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + if (sTouchID) + { + btnFingerprintUnlockSwtichIcon.MouseUpEventHandler = (sender, e1) => + { + Action fingerAction = () => { + TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint)); + }; + new AppUnlockPage().LoadGesturePage("5",fingerAction); + + TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint)); + + TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) => + { + if (e == TouchIDUtils.TouchIDState.Success) + { + var result = btnFingerprintUnlockSwtichIcon.IsSelected = !btnFingerprintUnlockSwtichIcon.IsSelected; + if (result) + { + if (!MainPage.LoginUser.appUnlockType.Contains("3")) + { + MainPage.LoginUser.appUnlockType.Add("3"); + MainPage.LoginUser.SaveUserInfo(); + } + } + else + { + if (MainPage.LoginUser.appUnlockType.Contains("3")) + { + MainPage.LoginUser.appUnlockType.Remove("3"); + MainPage.LoginUser.SaveUserInfo(); + } + } + //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1); + MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent(); + } + else// if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout) + { + if (MainPage.LoginUser.appUnlockType.Contains("1")) + { + var page = new AppUnlockPasswordPage(MainPage.LoginUser.appUnlockPasswrod, refreshAction); + MainPage.BasePageView.AddChidren(page); + page.LoadPage("5"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + else if (MainPage.LoginUser.appUnlockType.Contains("2")) + { + var page = new AppUnlockGesturePage(MainPage.LoginUser.appUnlockPasswrod, refreshAction); + MainPage.BasePageView.AddChidren(page); + page.LoadPage("5"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + } + } + }; + }; + } + if (sFaceID) + { + btnFaceIdUnlockSwtichIcon.MouseUpEventHandler = (sender, e1) => + { + //btnFaceIdUnlockSwtichIcon.IsSelected = !btnFaceIdUnlockSwtichIcon.IsSelected; + if (!btnFaceIdUnlockSwtichIcon.IsSelected) + { } + }; + } } } -} +} \ No newline at end of file -- Gitblit v1.8.0