From 7f233a10afa6882b4d9531185af60e8843bc1af2 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期一, 11 五月 2020 09:21:36 +0800 Subject: [PATCH] 20200511 --- HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs | 305 ++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 269 insertions(+), 36 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..12935c0 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,75 +26,215 @@ /// </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; + btnTipMsg.Visible = true; - 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; @@ -99,21 +249,21 @@ /// </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; } - if (MainPage.LoginUser.appUnlock.Contains("2")) + if (MainPage.LoginUser.appUnlockPage.Contains("2")) { btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true; } - if (MainPage.LoginUser.appUnlock.Contains("3")) + if (MainPage.LoginUser.appUnlockPage.Contains("3")) { btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true; } @@ -125,13 +275,96 @@ /// </summary> void LoadEvet_SkipEventList() { + + 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("2"); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + if (sTouchID) + { + btnFingerprintUnlockSwtichIcon.MouseUpEventHandler = (sender, e1) => + { + 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(); + } + } + } + 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("6"); + 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