From dc0309e64f02227d8e1468b7326c07955f804612 Mon Sep 17 00:00:00 2001 From: chenqiyang <1406175257@qq.com> Date: 星期三, 22 六月 2022 11:22:18 +0800 Subject: [PATCH] 修改引用路径 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswGestureSecirityForm.cs | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 171 insertions(+), 0 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswGestureSecirityForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswGestureSecirityForm.cs new file mode 100644 index 0000000..a40b222 --- /dev/null +++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswGestureSecirityForm.cs @@ -0,0 +1,171 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Text; + +namespace Shared.Phone.UserCenter +{ + /// <summary> + /// 鎵嬪娍瀵嗙爜楠岃瘉鐣岄潰 + /// </summary> + public class PswGestureSecirityForm : 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(239); + frameBack.Gravity = Gravity.CenterHorizontal; + frameBack.Width = Application.GetRealWidth(965); + frameBack.Height = Application.GetRealHeight(1486); + frameBack.BackgroundColor = UserCenterColor.Current.White; + frameBack.Radius = (uint)Application.GetRealHeight(17); + bodyFrameLayout.AddChidren(frameBack); + + //鎵嬪娍楠岃瘉鎺т欢 + var gestureControl = new PswGestureInputControl(i_GestureText); + gestureControl.Y = Application.GetRealHeight(69); + frameBack.AddChidren(gestureControl); + gestureControl.InitControl(); + //娣诲姞鍏抽棴鎸夐挳 + var btnClose = gestureControl.AddCloseButton(); + btnClose.ButtonClickEvent += (sender, e) => + { + this.CloseForm(); + }; + gestureControl.FinishInputEvent += (Password, pswLeng) => + { + if (UserCenterResourse.AccountOption.GestureAuthentication != Password) + { + UserCenterResourse.AccountOption.PasswordGestureInputCount--; + if (UserCenterResourse.AccountOption.PasswordGestureInputCount <= 0) + { + //绠$悊鍛樿韩浠介獙璇佸け璐�,璇烽噸鏂扮櫥褰� + string msg2 = Language.StringByID(R.MyInternationalizationString.uCheckAdministratorFailAndReload); + this.ShowMassage(ShowMsgType.Tip, msg2); + UserCenterLogic.ReLoginAgain(Common.Config.Instance.Account); + return; + } + //瀵嗙爜閿欒锛岃閲嶆柊杈撳叆 + gestureControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uOldPsswordIsError)); + return; + } + //閲嶇疆鍓╀綑瀵嗙爜娆℃暟 + UserCenterResourse.AccountOption.ResetPasswordCount(); + //鐣岄潰鍏抽棴 + this.CloseForm(); + SuccessAction?.Invoke(); + SuccessAction = null; + }; + + //Touch ID寮�閿� + var btnTouch = new BottomLeftClickButton(frameBack.Width / 2, Application.GetRealHeight(127)); + 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); + }; + + //瀵嗙爜寮�閿� + var btnPsw = new BottomRightClickButton(frameBack.Width - btnTouch.Width, btnTouch.Height); + frameBack.AddChidren(btnPsw); + btnPsw.InitControl(i_PasswordText); + if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.PswAuthentication) == true) + { + //娌℃湁鍚敤瀵嗙爜寮�閿� + btnPsw.CanClick = false; + } + btnPsw.ButtonClickEvent += (sender, e) => + { + var form = new PswSecondarySecurityForm(); + this.AddFromAndRemoveNowForm(form, i_TouchText, i_PasswordText, i_GestureText, SuccessAction); + }; + } + + #endregion + + #region 鈻� 鐣岄潰鍏抽棴___________________________ + + public override void CloseFormBefore() + { + //鍙栨秷浜嬩欢 + TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = null; + + base.CloseFormBefore(); + } + + #endregion + } +} -- Gitblit v1.8.0