| | |
| | | { |
| | | 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> |
| | |
| | | /// </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:当前设备不支持TouchID验证,请输入密码来验证"); |
| | | } |
| | | 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; |
| | |
| | | /// </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; |
| | | } |
| | |
| | | /// </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) |
| | | { } |
| | | }; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |