From a4924de3136289d10cabbf2f61a228387d44ded7 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 07 十一月 2019 13:48:36 +0800
Subject: [PATCH] Merge branch 'dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs |  175 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 175 insertions(+), 0 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs
new file mode 100755
index 0000000..0147058
--- /dev/null
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Form/PswSecondarySecurityForm.cs
@@ -0,0 +1,175 @@
+锘縰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)
+                {
+                    //瀵嗙爜閿欒锛岃閲嶆柊杈撳叆
+                    pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uOldPsswordIsError));
+                    pswControl.ResetControlInfo(i_PasswordText, false);
+                    return;
+                }
+                //鐣岄潰鍏抽棴
+                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
+    }
+}

--
Gitblit v1.8.0