From 351bdda734832d821a9764b0cde8be5d83c4ec50 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期四, 01 十二月 2022 09:56:25 +0800 Subject: [PATCH] 2022年12月01日09:56:23 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs | 362 +++++++++++++++++++++++++-------------------------- 1 files changed, 177 insertions(+), 185 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs old mode 100755 new mode 100644 index 0467e69..024a7a4 --- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs @@ -1,185 +1,177 @@ -锘縰sing System; -using System.Collections.Generic; -using System.Text; - -namespace Shared.Phone.UserCenter -{ - /// <summary> - /// 浜屾瀵嗙爜楠岃瘉鐣岄潰 - /// </summary> - public class PswSecondarySecurityForm : DialogCommonForm - { - #region 鈻� 鍙橀噺澹版槑___________________________ - - #endregion - - #region 鈻� 鍒濆鍖朹____________________________ - - /// <summary> - /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) - /// </summary> - /// <param name="i_TouchText">Touch ID楠岃瘉鐨勬樉绀烘枃鏈�</param> - /// <param name="i_PasswordText">瀵嗙爜楠岃瘉鐨勬樉绀烘枃鏈�</param> - /// <param name="i_GestureText">鎵嬪娍楠岃瘉鐨勬樉绀烘枃鏈�</param> - /// <param name="SuccessAction">楠岃瘉鎴愬姛鍚庣殑鍥炶皟鍑芥暟,濡傛灉涓嶆垚鍔�,涓嶄細璋冪敤杩欎釜涓滆タ</param> - public void ShowForm(string i_TouchText, string i_PasswordText, string i_GestureText, Action SuccessAction) - { - //鍒濆鍖栦腑閮ㄤ俊鎭� - this.InitMiddleFrame(i_TouchText, i_PasswordText, i_GestureText, SuccessAction); - } - - /// <summary> - /// 鍒濆鍖栦腑閮ㄤ俊鎭� - /// </summary> - /// <param name="i_TouchText">Touch ID楠岃瘉鐨勬樉绀烘枃鏈�</param> - /// <param name="i_PasswordText">瀵嗙爜楠岃瘉鐨勬樉绀烘枃鏈�</param> - /// <param name="i_GestureText">鎵嬪娍楠岃瘉鐨勬樉绀烘枃鏈�</param> - /// <param name="SuccessAction">楠岃瘉鎴愬姛鍚庣殑鍥炶皟鍑芥暟,濡傛灉涓嶆垚鍔�,涓嶄細璋冪敤杩欎釜涓滆タ</param> - private void InitMiddleFrame(string i_TouchText, string i_PasswordText, string i_GestureText, Action SuccessAction) - { - var frameBack = new FrameLayout(); - frameBack.Y = Application.GetRealHeight(101); - frameBack.Gravity = Gravity.CenterHorizontal; - frameBack.Width = Application.GetRealWidth(965); - frameBack.Height = Application.GetRealHeight(1711); - frameBack.BackgroundColor = UserCenterColor.Current.White; - frameBack.Radius = 6; - bodyFrameLayout.AddChidren(frameBack); - - //瀵嗙爜杈撳叆鎺т欢 - var pswControl = new PswNumberInputControl(i_PasswordText, 4); - pswControl.Gravity = Gravity.CenterHorizontal; - pswControl.Y = Application.GetRealHeight(81); - frameBack.AddChidren(pswControl); - pswControl.InitControl(); - //鏀瑰彉鍒犻櫎鎸夐挳鐨勫潗鏍� - pswControl.ChangedDeleteButtonPoint(-1, pswControl.Height, false); - //娣诲姞鍏抽棴鎸夐挳 - var btnClose = pswControl.AddCloseButton(); - btnClose.ButtonClickEvent += (sender, e) => - { - this.CloseForm(); - }; - pswControl.FinishInputEvent += (strPsw) => - { - if (UserCenterResourse.Option.PswAuthentication != strPsw) - { - UserCenterResourse.Option.PasswordInputCount--; - if (UserCenterResourse.Option.PasswordInputCount <= 0) - { - //绠$悊鍛樿韩浠介獙璇佸け璐�,璇烽噸鏂扮櫥褰� - string msg2 = Language.StringByID(R.MyInternationalizationString.uCheckAdministratorFailAndReload); - this.ShowMassage(ShowMsgType.Tip, msg2); - UserCenterLogic.ReLoginAgain(Common.Config.Instance.Account); - return; - } - //瀵嗙爜閿欒锛岃閲嶆柊杈撳叆 - pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uOldPsswordIsError)); - return; - } - //閲嶇疆鍓╀綑瀵嗙爜娆℃暟 - UserCenterResourse.Option.ResetPasswordCount(); - //鐣岄潰鍏抽棴 - this.CloseForm(); - SuccessAction?.Invoke(); - SuccessAction = null; - }; - - //鎵嬪娍寮�閿� - var btnGesture = new NormalClickButton(frameBack.Width / 2, Application.GetRealHeight(127)); - btnGesture.oldBackgroundColor = 0xfff5f6fa; - btnGesture.BackgroundColor = 0xfff5f6fa; - btnGesture.Text = i_GestureText; - btnGesture.TextColor = UserCenterColor.Current.TextColor1; - btnGesture.Gravity = Gravity.BottomLeft; - frameBack.AddChidren(btnGesture); - if (string.IsNullOrEmpty(UserCenterResourse.Option.GestureAuthentication) == true) - { - //娌℃湁鍚敤鎵嬪娍寮�閿� - btnGesture.CanClick = false; - } - - btnGesture.ButtonClickEvent += (sender, e) => - { - var form = new PswGestureSecirityForm(); - this.AddFromAndRemoveNowForm(form, i_TouchText, i_PasswordText, i_GestureText, SuccessAction); - }; - - //Touch ID寮�閿� - var btnTouch = new NormalClickButton(frameBack.Width / 2, Application.GetRealHeight(127)); - btnTouch.BackgroundColor = 0xff232323; - btnTouch.oldBackgroundColor = 0xff232323; - btnTouch.Text = i_TouchText; - btnTouch.TextColor = UserCenterColor.Current.White; - btnTouch.Gravity = Gravity.BottomRight; - frameBack.AddChidren(btnTouch); - if (UserCenterResourse.Option.FingerprintAuthentication == false) - { - //娌℃湁鍚敤Touch ID - btnTouch.CanClick = false; - } - - btnTouch.ButtonClickEvent += (sender, e) => - { - //浜屾妫�娴� - TouchIDUtils.TouchIDSupperType type = TouchIDUtils.getTouchIDSupperType(); - if (type != TouchIDUtils.TouchIDSupperType.TouchID) - { - return; - } - - //鐣岄潰鍏抽棴 - this.CloseForm(); - - TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent += (sender2, e2) => - { - if (e2 == TouchIDUtils.TouchIDState.Success) - { - TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; - - //TouchID楠岃瘉鎴愬姛 - SuccessAction?.Invoke(); - SuccessAction = null; - } - else if (e2 == TouchIDUtils.TouchIDState.InputPassword) - { - TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; - - //瀵嗙爜楠岃瘉 - if (string.IsNullOrEmpty(UserCenterResourse.Option.PswAuthentication) == false) - { - var form = new PswSecondarySecurityForm(); - this.AddFromAndRemoveNowForm(form, i_TouchText, i_PasswordText, i_GestureText, SuccessAction); - } - //鎵嬪娍楠岃瘉 - else if (string.IsNullOrEmpty(UserCenterResourse.Option.GestureAuthentication) == false) - { - var form = new PswGestureSecirityForm(); - this.AddFromAndRemoveNowForm(form, i_TouchText, i_PasswordText, i_GestureText, SuccessAction); - } - else - { - //娌℃湁璁剧疆瀵嗙爜楠岃瘉 - this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uPasswordAuthenticationNotSettion)); - } - } - }; - TouchIDUtils.Instance.showTouchIDWithDescribe(null, null); - }; - } - - #endregion - - #region 鈻� 鐣岄潰鍏抽棴___________________________ - - public override void CloseForm() - { - //鍙栨秷浜嬩欢 - TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; - - base.CloseForm(); - } - - #endregion - } -} +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 浜屾瀵嗙爜楠岃瘉鐣岄潰 + /// </summary> + public class PswSecondarySecurityForm : DialogCommonForm + { + #region 鈻� 鍙橀噺澹版槑___________________________ + + #endregion + + #region 鈻� 鍒濆鍖朹____________________________ + + /// <summary> + /// 鐢婚潰鏄剧ず(搴曞眰浼氬浐瀹氳皟鐢ㄦ鏂规硶锛屽�熶互瀹屾垚鐢婚潰鍒涘缓) + /// </summary> + /// <param name="i_TouchText">Touch ID楠岃瘉鐨勬樉绀烘枃鏈�</param> + /// <param name="i_PasswordText">瀵嗙爜楠岃瘉鐨勬樉绀烘枃鏈�</param> + /// <param name="i_GestureText">鎵嬪娍楠岃瘉鐨勬樉绀烘枃鏈�</param> + /// <param name="SuccessAction">楠岃瘉鎴愬姛鍚庣殑鍥炶皟鍑芥暟,濡傛灉涓嶆垚鍔�,涓嶄細璋冪敤杩欎釜涓滆タ</param> + public void ShowForm(string i_TouchText, string i_PasswordText, string i_GestureText, Action SuccessAction) + { + //鍒濆鍖栦腑閮ㄤ俊鎭� + this.InitMiddleFrame(i_TouchText, i_PasswordText, i_GestureText, SuccessAction); + } + + /// <summary> + /// 鍒濆鍖栦腑閮ㄤ俊鎭� + /// </summary> + /// <param name="i_TouchText">Touch ID楠岃瘉鐨勬樉绀烘枃鏈�</param> + /// <param name="i_PasswordText">瀵嗙爜楠岃瘉鐨勬樉绀烘枃鏈�</param> + /// <param name="i_GestureText">鎵嬪娍楠岃瘉鐨勬樉绀烘枃鏈�</param> + /// <param name="SuccessAction">楠岃瘉鎴愬姛鍚庣殑鍥炶皟鍑芥暟,濡傛灉涓嶆垚鍔�,涓嶄細璋冪敤杩欎釜涓滆タ</param> + private void InitMiddleFrame(string i_TouchText, string i_PasswordText, string i_GestureText, Action SuccessAction) + { + var frameBack = new FrameLayout(); + frameBack.Y = Application.GetRealHeight(101); + frameBack.Gravity = Gravity.CenterHorizontal; + frameBack.Width = Application.GetRealWidth(965); + frameBack.Height = Application.GetRealHeight(1711); + frameBack.BackgroundColor = UserCenterColor.Current.White; + frameBack.Radius = (uint)Application.GetRealHeight(17); + bodyFrameLayout.AddChidren(frameBack); + + //瀵嗙爜杈撳叆鎺т欢 + var pswControl = new PswNumberInputControl(i_PasswordText, 4); + pswControl.Gravity = Gravity.CenterHorizontal; + pswControl.Y = Application.GetRealHeight(81); + frameBack.AddChidren(pswControl); + pswControl.InitControl(); + //鏀瑰彉鍒犻櫎鎸夐挳鐨勫潗鏍� + pswControl.ChangedDeleteButtonPoint(-1, pswControl.Height, false); + //娣诲姞鍏抽棴鎸夐挳 + var btnClose = pswControl.AddCloseButton(); + btnClose.ButtonClickEvent += (sender, e) => + { + this.CloseForm(); + }; + pswControl.FinishInputEvent += (strPsw) => + { + if (UserCenterResourse.AccountOption.PswAuthentication != strPsw) + { + UserCenterResourse.AccountOption.PasswordInputCount--; + if (UserCenterResourse.AccountOption.PasswordInputCount <= 0) + { + //绠$悊鍛樿韩浠介獙璇佸け璐�,璇烽噸鏂扮櫥褰� + string msg2 = Language.StringByID(R.MyInternationalizationString.uCheckAdministratorFailAndReload); + this.ShowMassage(ShowMsgType.Tip, msg2); + UserCenterLogic.ReLoginAgain(Common.Config.Instance.Account); + return; + } + //瀵嗙爜閿欒锛岃閲嶆柊杈撳叆 + pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uOldPsswordIsError)); + return; + } + //閲嶇疆鍓╀綑瀵嗙爜娆℃暟 + UserCenterResourse.AccountOption.ResetPasswordCount(); + //鐣岄潰鍏抽棴 + this.CloseForm(); + SuccessAction?.Invoke(); + SuccessAction = null; + }; + + //鎵嬪娍寮�閿� + var btnGesture = new BottomLeftClickButton(frameBack.Width / 2, Application.GetRealHeight(127)); + frameBack.AddChidren(btnGesture); + btnGesture.InitControl(i_GestureText); + if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.GestureAuthentication) == true) + { + //娌℃湁鍚敤鎵嬪娍寮�閿� + btnGesture.CanClick = false; + } + + btnGesture.ButtonClickEvent += (sender, e) => + { + var form = new PswGestureSecirityForm(); + this.AddFromAndRemoveNowForm(form, i_TouchText, i_PasswordText, i_GestureText, SuccessAction); + }; + + //Touch ID寮�閿� + var btnTouch = new BottomRightClickButton(frameBack.Width - btnGesture.Width, btnGesture.Height); + frameBack.AddChidren(btnTouch); + btnTouch.InitControl(i_TouchText); + if (UserCenterResourse.AccountOption.FingerprintAuthentication == false) + { + //娌℃湁鍚敤Touch ID + btnTouch.CanClick = false; + } + + btnTouch.ButtonClickEvent += (sender, e) => + { + //浜屾妫�娴� + TouchIDUtils.TouchIDSupperType type = TouchIDUtils.getTouchIDSupperType(); + if (type != TouchIDUtils.TouchIDSupperType.TouchID) + { + return; + } + + //鐣岄潰鍏抽棴 + this.CloseForm(); + + TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent += (sender2, e2) => + { + if (e2 == TouchIDUtils.TouchIDState.Success) + { + TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; + + //TouchID楠岃瘉鎴愬姛 + SuccessAction?.Invoke(); + SuccessAction = null; + } + else if (e2 == TouchIDUtils.TouchIDState.InputPassword) + { + TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; + + //瀵嗙爜楠岃瘉 + if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.PswAuthentication) == false) + { + var form = new PswSecondarySecurityForm(); + this.AddFromAndRemoveNowForm(form, i_TouchText, i_PasswordText, i_GestureText, SuccessAction); + } + //鎵嬪娍楠岃瘉 + else if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.GestureAuthentication) == false) + { + var form = new PswGestureSecirityForm(); + this.AddFromAndRemoveNowForm(form, i_TouchText, i_PasswordText, i_GestureText, SuccessAction); + } + else + { + //娌℃湁璁剧疆瀵嗙爜楠岃瘉 + this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uPasswordAuthenticationNotSettion)); + } + } + }; + TouchIDUtils.Instance.showTouchIDWithDescribe(null, null); + }; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + public override void CloseFormBefore() + { + //鍙栨秷浜嬩欢 + TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; + + base.CloseFormBefore(); + } + + #endregion + } +} -- Gitblit v1.8.0