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/AppUnlockPasswordPage.cs |  150 +++++++++++++++++++++++++++++++++----------------
 1 files changed, 101 insertions(+), 49 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs
index 4934c6b..ccb481a 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockPasswordPage.cs
@@ -23,6 +23,7 @@
         public AppUnlockPasswordPage(string pw, Action action)
         {
             bodyView = this;
+            bodyView.Tag = "unlockpage";
             oldPasswrod = pw;
             backAction = action;
         }
@@ -58,12 +59,15 @@
             };
             bodyView.AddChidren(btnTipTitle);
 
-
-            if (optionType == "2" || optionType == "3")
+            if (optionType == "1")
+            {
+                btnTipTitle.TextID = string.IsNullOrEmpty(oldPasswrod) ? StringId.PlsEntryPassword : StringId.PlsRegisterRepeatPassword;
+            }
+            else if (optionType == "2")
             {
                 btnTipTitle.TextID = StringId.PleaseEnterTheOriginalDigitalPassword;
             }
-            if (optionType == "7")
+            else
             {
                 btnTipTitle.TextID = StringId.PlsEntryPassword;
             }
@@ -143,7 +147,7 @@
             etPassword = new EditText()
             {
                 Y = Application.GetRealWidth(100),
-                Height = Application.GetRealWidth(0),
+                Height = 1,
                 Foucs = true,
                 //Visible = false,
                 IsNumberKeyboardType = true,
@@ -152,7 +156,8 @@
 
             //etPassword.MouseUpEventHandler = (sender, e) => { };
 
-            etPassword.TextChangeEventHandler = (sender, e) => {
+            etPassword.TextChangeEventHandler = (sender, e) =>
+            {
                 passwrod = etPassword.Text.Trim();
                 switch (etPassword.Text.Trim().Length)
                 {
@@ -214,7 +219,8 @@
                 }
             };
 
-            EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
+            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
+            {
                 etPassword.Foucs = true;
             };
             bodyView.MouseUpEventHandler = eventHandler;
@@ -225,18 +231,16 @@
 
             etPassword.Foucs = true;
 
-            //鍔犺浇搴曢儴楠岃瘉鎸夐挳
-            if (optionType == "3" || optionType == "5" || optionType == "6")
-            {
-                //杈撳叆鐧诲綍瀵嗙爜楠岃瘉 鎻愮ず鎸夐挳
-                AddInputPasswordTipButton();
-            }
-            else if(optionType == "7")
+            if (optionType == "7")
             {
                 //浣跨敤璐︽埛瀵嗙爜鐧诲綍鎸夐挳 鎻愮ず鎸夐挳
                 AddLoginTipButton();
             }
-
+            else if (optionType != "1")
+            {
+                //杈撳叆鐧诲綍瀵嗙爜楠岃瘉 鎻愮ず鎸夐挳
+                AddInputPasswordTipButton(optionType);
+            }
         }
 
 
@@ -285,26 +289,33 @@
                 if (TouchIDUtils.getTouchIDSupperType() != TouchIDUtils.TouchIDSupperType.None)
                 {
                     var unlockType = TouchIDUtils.getTouchIDSupperType() == TouchIDUtils.TouchIDSupperType.TouchID ? "3" : "4";
-                    Action<bool> action = (result) =>
+
+                    //濡傛灉涔嬪墠娌¤缃寚绾规垨鑰呴潰瀹笽D鎵嶆樉绀烘槸鍚﹀紑鍚�
+                    if (!UserInfo.Current.appUnlockType.Contains(unlockType))
                     {
-                        if (result)
+                        Action<bool> action = (result) =>
                         {
-                            if (!UserInfo.Current.appUnlockType.Contains(unlockType))
+                            if (result)
                             {
-                                UserInfo.Current.appUnlockType.Add(unlockType);
+                                if (!UserInfo.Current.appUnlockType.Contains(unlockType))
+                                {
+                                    UserInfo.Current.appUnlockType.Add(unlockType);
+                                }
                             }
-                        }
-                        else
-                        {
-                            if (UserInfo.Current.appUnlockType.Contains(unlockType))
+                            else
                             {
-                                UserInfo.Current.appUnlockType.Remove(unlockType);
+                                if (UserInfo.Current.appUnlockType.Contains(unlockType))
+                                {
+                                    UserInfo.Current.appUnlockType.Remove(unlockType);
+                                }
                             }
-                        }
-                        backAction();
-                        UserInfo.Current.SaveUserInfo();
-                    };
-                    page.AdditionalOperations(tipMsg, action);
+                            backAction();
+                            UserInfo.Current.SaveUserInfo();
+                        };
+
+
+                        page.AdditionalOperations(tipMsg, action);
+                    }
                 }
                 if (!UserInfo.Current.appUnlockType.Contains("1"))
                 {
@@ -384,7 +395,8 @@
         /// <summary>
         /// 浣跨敤璐︽埛瀵嗙爜鐧诲綍鎸夐挳 鎻愮ず鎸夐挳
         /// </summary>
-        void AddLoginTipButton(){
+        void AddLoginTipButton()
+        {
             Button btnLoginAccountVerify = new Button()
             {
                 Y = Application.GetRealHeight(517),
@@ -406,7 +418,7 @@
         /// <summary>
         /// 杈撳叆鐧诲綍瀵嗙爜楠岃瘉 鎻愮ず鎸夐挳
         /// </summary>
-        void AddInputPasswordTipButton()
+        void AddInputPasswordTipButton(string optionType)
         {
             Button btnLoginAccountVerify = new Button()
             {
@@ -422,30 +434,70 @@
             btnLoginAccountVerify.MouseUpEventHandler = (sender, e) =>
             {
                 //杈撳叆鐧诲綍瀵嗙爜楠岃瘉
-                Action<string> action = (pw) => {
-                    var resultObj = new HttpServerRequest().LoginByPassword(UserInfo.Current.AccountString, pw);
-                    if (resultObj.Code.ToUpper() == StateCode.SUCCESS)
-                    {
-                        UserInfo.Current.appUnlockPasswrod = "";
-                        UserInfo.Current.appUnlockType = new System.Collections.Generic.List<string>();
-                        UserInfo.Current.SaveUserInfo();
-                        this.RemoveFromParent();
-                        backAction();
-                    }
-                    else
-                    {
-                        Application.RunOnMainThread(() =>
-                        {
-                            Utlis.ShowTip(Language.StringByID(StringId.AuthenticationFailedPasswordError));
-                        });
-                        ////鐧诲綍澶辫触
-                        //IMessageCommon.Current.ShowErrorInfoAlter(resultObj.Code);
-                    }
+                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();
+        }
     }
 }

--
Gitblit v1.8.0