From 25429f085093d89d543a0b90e30d0d62d1b7dac9 Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期二, 30 八月 2022 09:37:38 +0800
Subject: [PATCH] 合并了IOS的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Password/EditorGesturePasswordForm.cs |   72 +++++++++++++++++++++++++----------
 1 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/EditorGesturePasswordForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/EditorGesturePasswordForm.cs
index 3800429..8dfcc30 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Password/EditorGesturePasswordForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/EditorGesturePasswordForm.cs
@@ -30,12 +30,12 @@
         public void ShowForm()
         {
             //鐣岄潰鍙冲垝涓嶅彲
-            UserView.HomePage.Instance.ScrollEnabled = false;
+            this.ScrollEnabled = false;
 
             //璁剧疆澶撮儴淇℃伅
             base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uGestureAuthentication));
 
-            if (string.IsNullOrEmpty(UserCenterResourse.Option.GestureAuthentication) == false)
+            if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.GestureAuthentication) == false)
             {
                 formMode = FormMode.A楠岃瘉鍓嶅洖瀵嗙爜;
             }
@@ -103,7 +103,7 @@
                     form.AddForm();
                 };
                 //搴曠嚎
-                int lineWidth = btnForgotPsw.GetRealWidthByText(12);
+                int lineWidth = btnForgotPsw.GetRealWidthByText();
                 var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
                 btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
                 btnLine.Gravity = Gravity.CenterHorizontal;
@@ -146,17 +146,15 @@
                     pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uGestureNotEqual));
                     return;
                 }
-                UserCenterResourse.Option.GestureAuthentication = i_Psw;
-                UserCenterResourse.Option.Save();
-                //鍏抽棴鐣岄潰
-                this.CloseForm();
+                //淇濆瓨瀵嗙爜
+                this.SaveSecondaryPassword(pswControl, i_Psw);
             }
             else if (formMode == FormMode.A楠岃瘉鍓嶅洖瀵嗙爜)
             {
-                if (UserCenterResourse.Option.GestureAuthentication != i_Psw)
+                if (UserCenterResourse.AccountOption.GestureAuthentication != i_Psw)
                 {
-                    UserCenterResourse.Option.PasswordGestureInputCount--;
-                    if (UserCenterResourse.Option.PasswordGestureInputCount <= 0)
+                    UserCenterResourse.AccountOption.PasswordGestureInputCount--;
+                    if (UserCenterResourse.AccountOption.PasswordGestureInputCount <= 0)
                     {
                         //绠$悊鍛樿韩浠介獙璇佸け璐�,璇烽噸鏂扮櫥褰�
                         string msg2 = Language.StringByID(R.MyInternationalizationString.uCheckAdministratorFailAndReload);
@@ -169,13 +167,19 @@
                     return;
                 }
                 //閲嶇疆鍓╀綑瀵嗙爜娆℃暟
-                UserCenterResourse.Option.ResetPasswordCount();
+                UserCenterResourse.AccountOption.ResetPasswordCount();
 
                 formMode = FormMode.A淇敼瀵嗙爜;
                 this.InitMiddleFrame();
             }
             else if (formMode == FormMode.A淇敼瀵嗙爜)
             {
+                if (i_Psw == UserCenterResourse.AccountOption.GestureAuthentication)
+                {
+                    //鏂板瘑鐮佸拰鍘熷瘑鐮佷竴鑷达紝璇烽噸鏂拌緭鍏�
+                    pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uNewPswAndOldPswIsEqual));
+                    return;
+                }
                 if (pswLength <= 4)
                 {
                     //鎵嬪娍瀵嗙爜闀垮害蹇呴』澶т簬4
@@ -196,10 +200,8 @@
                     pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uGestureNotEqual));
                     return;
                 }
-                UserCenterResourse.Option.GestureAuthentication = i_Psw;
-                UserCenterResourse.Option.Save();
-                //鍏抽棴鐣岄潰
-                this.CloseForm();
+                //淇濆瓨瀵嗙爜
+                this.SaveSecondaryPassword(pswControl, i_Psw);
             }
         }
 
@@ -218,17 +220,45 @@
 
         #endregion
 
-        #region 鈻� 鐣岄潰鍏抽棴___________________________
+        #region 鈻� 淇濆瓨瀵嗙爜___________________________
 
         /// <summary>
-        /// 鐣岄潰鍏抽棴
+        /// 淇濆瓨瀵嗙爜
         /// </summary>
-        public override void CloseForm()
+        /// <param name="contr">鎺т欢</param>
+        /// <param name="psw">瀵嗙爜</param>
+        private void SaveSecondaryPassword(PswGestureInputControl contr, string psw)
         {
-            //鐣岄潰鍙冲垝鍙�
-            UserView.HomePage.Instance.ScrollEnabled = true;
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //鎵撳紑杩涘害鏉�
+                this.ShowProgressBar();
+                var pra = new
+                {
+                    RequestVersion = Common.CommonPage.RequestVersion,
+                    LoginAccessToken = Common.Config.Instance.Token,
+                    GesturePwd = psw,
+                    StringPwd = UserCenterResourse.AccountOption.PswAuthentication
+                };
+                var result = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdatEexpandPwd", false, pra);
+                //鍏抽棴杩涘害鏉�
+                this.CloseProgressBar();
 
-            base.CloseForm();
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    if (result == false)
+                    {
+                        contr.SetErrorMsg(string.Empty);
+                    }
+                    else
+                    {
+                        UserCenterResourse.AccountOption.GestureAuthentication = psw;
+                        UserCenterResourse.AccountOption.Save();
+                        //鐣岄潰鍏抽棴
+                        this.CloseForm();
+                    }
+                });
+            });
         }
 
         #endregion

--
Gitblit v1.8.0