From eda3fb873e59544ff36301b51e05aef64f87b0f9 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期五, 27 八月 2021 13:21:21 +0800 Subject: [PATCH] Merge branch 'newBranch1' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into newBranch1 --- HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs | 381 +++++++++++++++++++++++++++--------------------------- 1 files changed, 189 insertions(+), 192 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs index ccdee88..489d1a5 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockGesturePage.cs @@ -25,6 +25,7 @@ public AppUnlockGesturePage(string pw, Action action) { bodyView = this; + bodyView.Tag = "unlockpage"; oldPasswrod = pw; backAction = action; } @@ -66,7 +67,7 @@ IsBold = true, TextColor = CSS_Color.FirstLevelTitleColor, TextSize = CSS_FontSize.EmphasisFontSize_Secondary, - TextID = optionType == "7" ? StringId.SetGesturePassword : StringId.VerifyGesturePassword, + TextID = StringId.VerifyGesturePassword, }; bodyView.AddChidren(btnTipTitle); @@ -79,14 +80,27 @@ TextColor = CSS_Color.TextualColor, SelectedTextColor = CSS_Color.WarningColor, TextSize = CSS_FontSize.TextFontSize, - TextID = optionType == "2" ? StringId.DrawUnlockPatternAgain : StringId.DrawUnlockPattern, + TextID = StringId.DrawUnlockPattern, }; bodyView.AddChidren(btnTipMsg); - if (optionType == "7") + if (optionType == "1") { - btnTipTitle.TextID = StringId.DrawUnlockPattern; + btnTipMsg.TextID = string.IsNullOrEmpty(oldPasswrod) ? StringId.DrawUnlockPattern : StringId.DrawUnlockPatternAgain; + //璁剧疆鎵嬪娍瀵嗙爜 + btnTipTitle.TextID = StringId.SetGesturePassword; + }else if(optionType == "2") + { + //璇疯緭鍏ュ師鎵嬪娍瀵嗙爜 + btnTipTitle.TextID = StringId.PleaseDrawTheOriginalGesturePassword; } + + //if (optionType == "7") + //{ + // //璇风粯鍒惰В閿佸浘妗� + // btnTipTitle.TextID = StringId.DrawUnlockPattern; + //} + GestureLockView mGestureLockView = new GestureLockView { @@ -135,197 +149,67 @@ //瀵嗙爜楠岃瘉澶辫触 PasswordInputError(optionType); } - //if (optionType == "2") - //{ - // //绉婚櫎褰撳墠鐣岄潰锛屾瘡娆¤繑鍥為兘杩斿洖鍒版渶涓婄骇 - // this.RemoveFromParent(); - // var page = new AppUnlockGesturePage("", backAction); - // MainPage.BasePageView.AddChidren(page); - // page.LoadPage("1"); - // MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; - // return; - //} - //if(optionType == "7") - //{ - // if (passwrod == oldPasswrod) - // { - // this.RemoveFromParent(); - // backAction(); - // } - // else - // { - // btnTipMsg.TextID = StringId.AuthenticationFailedGestureError; - // btnTipMsg.IsSelected = true; - // btnTipMsg.Visible = true; - // } - // return; - //} - //if (optionType == "3" || optionType == "4") - //{ - // if (passwrod == oldPasswrod) - // { - // if (optionType == "4") - // { - // backAction(); - // this.RemoveFromParent(); - // return; - // } - // if (UserInfo.Current.appUnlockType.Contains("2")) - // { - // UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); - // UserInfo.Current.appUnlockPasswrod = ""; - // UserInfo.Current.SaveUserInfo(); - // this.RemoveFromParent(); - // backAction(); - // } - // } - // else - // { - // btnTipMsg.TextID = StringId.AuthenticationFailedGestureError; - // btnTipMsg.IsSelected = true; - // btnTipMsg.Visible = true; - // } - // return; - //} - //if (optionType == "5" || optionType == "6"|| optionType == "8" || optionType == "9") - //{ - // if (passwrod == oldPasswrod) - // { - // if (optionType == "5" )//&& UserInfo.Current.appUnlockType.Contains("3")) - // { - // if (UserInfo.Current.appUnlockType.Contains("3")) - // UserInfo.Current.appUnlockType.Remove("3"); - // else - // UserInfo.Current.appUnlockType.Add("3"); - - // UserInfo.Current.SaveUserInfo(); - // this.RemoveFromParent(); - // } - // if ( optionType == "6") - // { - // if (UserInfo.Current.appUnlockType.Contains("4")) - // UserInfo.Current.appUnlockType.Remove("4"); - // else - // UserInfo.Current.appUnlockType.Add("4"); - - // UserInfo.Current.SaveUserInfo(); - // this.RemoveFromParent(); - // } - // if (optionType == "8" && !UserInfo.Current.appUnlockType.Contains("3")) - // { - // UserInfo.Current.appUnlockType.Add("3"); - // UserInfo.Current.SaveUserInfo(); - // this.RemoveFromParent(); - // } - // if (!UserInfo.Current.appUnlockType.Contains("4") && optionType == "9") - // { - // UserInfo.Current.appUnlockType.Remove("4"); - // UserInfo.Current.SaveUserInfo(); - // this.RemoveFromParent(); - // } - // backAction(); - // } - // else - // { - // btnTipMsg.TextID = StringId.AuthenticationFailedGestureError; - // btnTipMsg.IsSelected = true; - // btnTipMsg.Visible = true; - // } - // return; - //} - //if (passwrod == oldPasswrod) - //{ - // this.RemoveFromParent(); - // var page = new OperationResultDisPalyPage(); - // page.Show(); - // page.LoadPage(true, Language.StringByID(StringId.SetSuccessfully), Language.StringByID(StringId.SetSuccessfully), ""); - // //page.LoadPage(true, Language.StringByID(StringId.SetSuccessfully), Language.StringByID(StringId.SetSuccessfully), ""); - // string tipMsg = TouchIDUtils.getTouchIDSupperType() == TouchIDUtils.TouchIDSupperType.TouchID ? Language.StringByID(StringId.TurnOnFingerprintUnlocking) : - // Language.StringByID(StringId.TurnOnFaceIdUnlocking); - // if (TouchIDUtils.getTouchIDSupperType() != TouchIDUtils.TouchIDSupperType.None) - // { - // Action<bool> action = (result) => - // { - // var unlockType = TouchIDUtils.getTouchIDSupperType() == TouchIDUtils.TouchIDSupperType.TouchID ? "3" : "4"; - // if (result) - // { - // if (!UserInfo.Current.appUnlockType.Contains(unlockType)) - // { - // UserInfo.Current.appUnlockType.Add(unlockType); - // } - // } - // else - // { - // if (UserInfo.Current.appUnlockType.Contains(unlockType)) - // { - // UserInfo.Current.appUnlockType.Remove(unlockType); - // } - // } - // UserInfo.Current.SaveUserInfo(); - // backAction(); - // }; - // page.AdditionalOperations(tipMsg, action); - // } - // if (!UserInfo.Current.appUnlockType.Contains("2")) - // { - // UserInfo.Current.appUnlockType.Add("2"); - // } - // UserInfo.Current.appUnlockPasswrod = passwrod; - // UserInfo.Current.SaveUserInfo(); - // backAction(); - //} - //else - //{ - // btnTipMsg.Text = Language.StringByID(StringId.DrawingInconsistencyError); - // btnTipMsg.IsSelected = true; - //} + } }; - if (optionType == "5" || optionType == "6" || optionType == "7") + + if (optionType == "7") { - Button btnLoginAccountVerify = new Button() - { - Y = Application.GetRealHeight(517), - Height = Application.GetRealHeight(60), - TextAlignment = TextAlignment.Center, - TextSize = CSS_FontSize.TextFontSize, - TextColor = CSS_Color.MainColor, - TextID = StringId.EnterLoginPasswordVerification, - }; - bodyView.AddChidren(btnLoginAccountVerify); - - btnLoginAccountVerify.MouseUpEventHandler = (sender, e) => - { - if (optionType == "7") - { - MainPage.GoLoginPage(UserInfo.Current); - } - else - { - Action<string> action = (pw) => - { - var resultObj = new HttpServerRequest().LoginByPassword(UserInfo.Current.AccountString, pw); - if (resultObj.Code == StateCode.SUCCESS) - { - UserInfo.Current.appUnlockPasswrod = ""; - UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); - UserInfo.Current.SaveUserInfo(); - this.RemoveFromParent(); - backAction(); - } - else - { - //鐧诲綍澶辫触 - IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); - } - - }; - new PublicAssmebly().LoadDialog_EditParater(StringId.EnterLoginPasswordVerification, "", action, StringId.PlsEntryPassword, 0, new System.Collections.Generic.List<string>(), true); - } - }; + //浣跨敤璐︽埛瀵嗙爜鐧诲綍鎸夐挳 鎻愮ず鎸夐挳 + AddLoginTipButton(); } + else if (optionType != "1") + { + //杈撳叆鐧诲綍瀵嗙爜楠岃瘉 鎻愮ず鎸夐挳 + AddInputPasswordTipButton(optionType); + } + + + //if (optionType == "5" || optionType == "6" || optionType == "7") + //{ + // Button btnLoginAccountVerify = new Button() + // { + // Y = Application.GetRealHeight(517), + // Height = Application.GetRealHeight(60), + // TextAlignment = TextAlignment.Center, + // TextSize = CSS_FontSize.TextFontSize, + // TextColor = CSS_Color.MainColor, + // TextID = StringId.EnterLoginPasswordVerification, + // }; + // bodyView.AddChidren(btnLoginAccountVerify); + + // btnLoginAccountVerify.MouseUpEventHandler = (sender, e) => + // { + // if (optionType == "7") + // { + // MainPage.GoLoginPage(UserInfo.Current); + // } + // else + // { + // Action<string> action = (pw) => + // { + // var resultObj = new HttpServerRequest().LoginByPassword(UserInfo.Current.AccountString, pw); + // if (resultObj.Code == StateCode.SUCCESS) + // { + // UserInfo.Current.appUnlockPasswrod = ""; + // UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>(); + // UserInfo.Current.SaveUserInfo(); + // this.RemoveFromParent(); + // backAction(); + // } + // else + // { + // //鐧诲綍澶辫触 + // IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code); + // } + + // }; + // new PublicAssmebly().LoadDialog_EditParater(StringId.EnterLoginPasswordVerification, "", action, StringId.PlsEntryPassword, 0, new System.Collections.Generic.List<string>(), true); + // } + // }; + //} } /// <summary> @@ -371,9 +255,13 @@ Language.StringByID(StringId.TurnOnFaceIdUnlocking); if (TouchIDUtils.getTouchIDSupperType() != TouchIDUtils.TouchIDSupperType.None) { - Action<bool> action = (result) => + var unlockType = TouchIDUtils.getTouchIDSupperType() == TouchIDUtils.TouchIDSupperType.TouchID ? "3" : "4"; + + //濡傛灉涔嬪墠娌¤缃寚绾规垨鑰呴潰瀹笽D鎵嶆樉绀烘槸鍚﹀紑鍚� + if (!UserInfo.Current.appUnlockType.Contains(unlockType)) { - var unlockType = TouchIDUtils.getTouchIDSupperType() == TouchIDUtils.TouchIDSupperType.TouchID ? "3" : "4"; + Action<bool> action = (result) => + { if (result) { if (!UserInfo.Current.appUnlockType.Contains(unlockType)) @@ -391,7 +279,8 @@ UserInfo.Current.SaveUserInfo(); backAction(); }; - page.AdditionalOperations(tipMsg, action); + page.AdditionalOperations(tipMsg, action); + } } if (!UserInfo.Current.appUnlockType.Contains("2")) { @@ -461,5 +350,113 @@ backAction(); } } + + + /// <summary> + /// 浣跨敤璐︽埛瀵嗙爜鐧诲綍鎸夐挳 鎻愮ず鎸夐挳 + /// </summary> + void AddLoginTipButton() + { + Button btnLoginAccountVerify = new Button() + { + Y = Application.GetRealHeight(517), + Height = Application.GetRealHeight(60), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.MainColor, + TextID = StringId.LogWithAccountAndPassword, + }; + bodyView.AddChidren(btnLoginAccountVerify); + + btnLoginAccountVerify.MouseUpEventHandler = (sender, e) => + { + //閫�鍑虹櫥褰� + HDLCommon.Current.Logout(); + }; + } + + /// <summary> + /// 杈撳叆鐧诲綍瀵嗙爜楠岃瘉 鎻愮ず鎸夐挳 + /// </summary> + void AddInputPasswordTipButton(string optionType) + { + Button btnLoginAccountVerify = new Button() + { + Y = Application.GetRealHeight(517), + Height = Application.GetRealHeight(60), + TextAlignment = TextAlignment.Center, + TextSize = CSS_FontSize.TextFontSize, + TextColor = CSS_Color.MainColor, + TextID = StringId.EnterLoginPasswordVerification, + }; + bodyView.AddChidren(btnLoginAccountVerify); + + btnLoginAccountVerify.MouseUpEventHandler = (sender, e) => + { + //杈撳叆鐧诲綍瀵嗙爜楠岃瘉 + Action<string> action = (pw) => + { + AuthenticationByLoginPassword(pw, optionType); + //var resultObj = new HttpServerRequest().LoginByPassword(UserInfo.Current.AccountString, pw); + //if (resultObj.Code == StateCode.SUCCESS) + //{ + // PasswordInputPassed(optionType); + //} + //else + //{ + // Application.RunOnMainThread(() => + // { + // Utlis.ShowTip(Language.StringByID(StringId.AuthenticationFailedPasswordError)); + // }); + //} + + }; + new PublicAssmebly().LoadDialog_EditParater(StringId.EnterLoginPasswordVerification, "", action, StringId.PlsEntryPassword, 0, new System.Collections.Generic.List<string>(), true); + }; + } + + /// <summary> + /// 鐧诲綍瀵嗙爜楠岃瘉 + /// </summary> + /// <param name="pw"></param> + /// <param name="optionType"></param> + void AuthenticationByLoginPassword(string pw, string optionType) + { + var waitPage = new Loading(); + bodyView.AddChidren(waitPage); + waitPage.Start(Language.StringByID(StringId.PleaseWait)); + + new System.Threading.Thread(() => + { + try + { + var resultObj = new HttpServerRequest().LoginByPassword(UserInfo.Current.AccountString, pw); + Application.RunOnMainThread(() => + { + if (resultObj.Code == StateCode.SUCCESS) + { + PasswordInputPassed(optionType); + } + else + { + Utlis.ShowTip(Language.StringByID(StringId.AuthenticationFailedPasswordError)); + } + }); + } + catch { } + finally + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.RemoveFromParent(); + waitPage = null; + } + }); + } + }) + { IsBackground = true }.Start(); + } } } \ No newline at end of file -- Gitblit v1.8.0