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/AppUnlockSettingsPageBLL.cs |  333 ++++++++++++++++++++++++++++++------------------------
 1 files changed, 184 insertions(+), 149 deletions(-)

diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs
index 0ef85c1..43e9dc3 100644
--- a/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs
+++ b/HDL_ON/UI/UI2/4-PersonalCenter/UnlockSetting/AppUnlockSettingsPageBLL.cs
@@ -34,7 +34,7 @@
                     btnStartupBg.IsSelected = btnStartupSelectionIcon.IsSelected = btnStartupSelectionTip.IsSelected = false;
                     #region F3闃舵
                     //btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = false;
-                    //btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = false;
+                    btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = false;
                     #endregion
 
                     btnTipMsg.TextID = StringId.UnprotectedTipMsg;
@@ -176,49 +176,49 @@
             //btnSecuritySelectionIcon.MouseUpEventHandler = eventHandler3;
             //btnSecuritySelectionTip.MouseUpEventHandler = eventHandler3;
 
-            //EventHandler<MouseEventArgs> eventHandler4 = (sender, e) =>
-            //{
-            //    bool result = !btnDoorlockBg.IsSelected;
-            //    if (!result)
-            //    {
-            //        //濡傛灉鍙墿杩滅▼寮�閿佷笉鑳藉彇娑堣繙绋嬪紑閿�
-            //        if (!CheckIfCanDeselect("3")) return;
-            //    }
+            EventHandler<MouseEventArgs> eventHandler4 = (sender, e) =>
+            {
+                bool result = !btnDoorlockBg.IsSelected;
+                if (!result)
+                {
+                    //濡傛灉鍙墿杩滅▼寮�閿佷笉鑳藉彇娑堣繙绋嬪紑閿�
+                    if (!CheckIfCanDeselect("3")) return;
+                }
 
-            //    btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = result;
+                btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = result;
 
-            //    btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg);
-            //    if (result)
-            //    {
-            //        btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false;
-            //        if (!UserInfo.Current.appUnlockPage.Contains("3"))
-            //        {
-            //            UserInfo.Current.appUnlockPage.Add("3");
-            //            if (UserInfo.Current.appUnlockPasswrod != "")
-            //                UserInfo.Current.SaveUserInfo();
-            //        }
-            //        unlockOptionView.Visible = true;
-            //    }
-            //    else
-            //    {
-            //        if (UserInfo.Current.appUnlockPage.Contains("3"))
-            //        {
-            //            UserInfo.Current.appUnlockPage.Remove("3");
-            //        }
-            //        if (UserInfo.Current.appUnlockPage.Count == 0)
-            //        {
-            //            btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true;
-            //            btnTipMsg.TextID = StringId.UnprotectedTipMsg;
-            //            UserInfo.Current.appUnlockPasswrod = "";
-            //            unlockOptionView.Visible = false;
-            //            refreshAction();
-            //        }
-            //        UserInfo.Current.SaveUserInfo();
-            //    }
-            //};
-            //btnDoorlockBg.MouseUpEventHandler = eventHandler4;
-            //btnDoorlockSelectionIcon.MouseUpEventHandler = eventHandler4;
-            //btnDoorlockSelectionTip.MouseUpEventHandler = eventHandler4;
+                btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg);
+                if (result)
+                {
+                    btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = false;
+                    if (!UserInfo.Current.appUnlockPage.Contains("3"))
+                    {
+                        UserInfo.Current.appUnlockPage.Add("3");
+                        if (UserInfo.Current.appUnlockPasswrod != "")
+                            UserInfo.Current.SaveUserInfo();
+                    }
+                    unlockOptionView.Visible = true;
+                }
+                else
+                {
+                    if (UserInfo.Current.appUnlockPage.Contains("3"))
+                    {
+                        UserInfo.Current.appUnlockPage.Remove("3");
+                    }
+                    if (UserInfo.Current.appUnlockPage.Count == 0)
+                    {
+                        btnUnprotectedBg.IsSelected = btnUnprotectedSelectionIcon.IsSelected = btnUnprotectedSelectionTip.IsSelected = true;
+                        btnTipMsg.TextID = StringId.UnprotectedTipMsg;
+                        UserInfo.Current.appUnlockPasswrod = "";
+                        unlockOptionView.Visible = false;
+                        refreshAction();
+                    }
+                    UserInfo.Current.SaveUserInfo();
+                }
+            };
+            btnDoorlockBg.MouseUpEventHandler = eventHandler4;
+            btnDoorlockSelectionIcon.MouseUpEventHandler = eventHandler4;
+            btnDoorlockSelectionTip.MouseUpEventHandler = eventHandler4;
             #endregion
         }
 
@@ -244,11 +244,11 @@
                 //    btnSecurityBg.IsSelected = btnSecuritySelectionIcon.IsSelected = btnSecuritySelectionTip.IsSelected = true;
                 //    btnTipMsg.Text = Language.StringByID(StringId.DefenseAndUndefenseTipMsg);
                 //}
-                //if (UserInfo.Current.appUnlockPage.Contains("3"))
-                //{
-                //    btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true;
-                //    btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg);
-                //}
+                if (UserInfo.Current.appUnlockPage.Contains("3"))
+                {
+                    btnDoorlockBg.IsSelected = btnDoorlockSelectionIcon.IsSelected = btnDoorlockSelectionTip.IsSelected = true;
+                    btnTipMsg.Text = Language.StringByID(StringId.RemoteUnlockingTipMsg);
+                }
                 #endregion
             }
         }
@@ -321,71 +321,16 @@
         }
 
         /// <summary>
-        /// 闈㈠ID寮�鍚拰鍏抽棴
+        /// 闈㈠ID楠岃瘉寮圭獥
         /// </summary>
-        void FaceIDVerification_SwtichOnOff()
+        /// <param name="successAction"></param>
+        /// <param name="goToVerifyPasswordAction"></param>
+        void FaceIDVerification_Show(Action successAction, Action goToVerifyPasswordAction)
         {
-            //6:闈㈠ID寮�鍏�
-            string optionType = "6";
-            //4:闈㈠ID
-            string faceIDUnlockType = "4";
+            //鎻愮ず鏁板瓧瀵嗙爜楠岃瘉杩樻槸缁樺埗鎵嬪娍楠岃瘉
+            string verificationTitleString = GetVerificationTitleString();
 
-            Action fingerAction = () =>
-            {
-                TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.VerifyFaceID));
-            };
-            new AppUnlockPage().LoadFaceIDGesturePage(optionType, fingerAction);
-
-            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.VerifyFaceID));
-
-            TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
-            {
-                if (e == TouchIDUtils.TouchIDState.Success)
-                {
-                    var result = btnFaceIdUnlockSwtichIcon.IsSelected = !btnFaceIdUnlockSwtichIcon.IsSelected;
-                    if (result)
-                    {
-                        if (!UserInfo.Current.appUnlockType.Contains(faceIDUnlockType))
-                        {
-                            UserInfo.Current.appUnlockType.Add(faceIDUnlockType);
-                            UserInfo.Current.SaveUserInfo();
-                        }
-                    }
-                    else
-                    {
-                        if (UserInfo.Current.appUnlockType.Contains(faceIDUnlockType))
-                        {
-                            UserInfo.Current.appUnlockType.Remove(faceIDUnlockType);
-                            UserInfo.Current.SaveUserInfo();
-                        }
-                    }
-                    //MainPage.BasePageView.RemoveAt(MainPage.BasePageView.ChildrenCount - 1);
-                    MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
-                }
-                else// if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout)
-                {
-                    ///灏嗛獙璇侀潰瀹笽D鐨勯〉闈㈢Щ闄�
-                    MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
-
-                    GotogoToVerifyPasswordPage(optionType, refreshAction);
-                }
-            };
-        }
-
-        /// <summary>
-        /// FaceID楠岃瘉 鍏抽棴瑙i攣璁剧疆
-        /// </summary>
-        /// <param name="action">楠岃瘉鎴愬姛浜嬩欢</param>
-        void FaceIDVerification_TurnOffUnlock(Action successAction)
-        {
-            //浣跨敤瀵嗙爜楠岃瘉
-            Action goToVerifyPasswordAction = () =>
-            {
-                //鍏抽棴瑙i攣楠岃瘉
-                GotogoToVerifyPasswordPage("4", successAction);
-            };
-
-            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.VerifyFaceID));
+            TouchIDUtils.Instance.showTouchIDWithDescribe(verificationTitleString, Language.StringByID(StringId.VerifyFaceID));
             TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
             {
                 if (e == TouchIDUtils.TouchIDState.Success)
@@ -407,68 +352,76 @@
         }
 
         /// <summary>
-        /// 鎸囩汗ID寮�鍚拰鍏抽棴
+        /// 闈㈠ID寮�鍚拰鍏抽棴
         /// </summary>
-        void TouchIDVerification_SwtichOnOff()
+        /// <param name="successAction">楠岃瘉鎴愬姛浜嬩欢</param>
+        void FaceIDVerification_SwtichOnOff()
         {
-            //5:鎸囩汗ID寮�鍏�
-            string optionType = "5";
-
-            Action fingerAction = () =>
+            //4:闈㈠ID
+            string faceIDUnlockType = "4";
+            //6:闈㈠ID寮�鍏�
+            string optionType = "6";
+            //鎴愬姛浜嬩欢
+            Action successAction = () =>
             {
-                TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
-            };
-            new AppUnlockPage().LoadGesturePage(optionType, fingerAction);
-
-            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
-
-            TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
-            {
-                if (e == TouchIDUtils.TouchIDState.Success)
+                var result = btnFaceIdUnlockSwtichIcon.IsSelected = !btnFaceIdUnlockSwtichIcon.IsSelected;
+                if (result)
                 {
-                    var result = btnFingerprintUnlockSwtichIcon.IsSelected = !btnFingerprintUnlockSwtichIcon.IsSelected;
-                    if (result)
+                    if (!UserInfo.Current.appUnlockType.Contains(faceIDUnlockType))
                     {
-                        if (!UserInfo.Current.appUnlockType.Contains("3"))
-                        {
-                            UserInfo.Current.appUnlockType.Add("3");
-                            UserInfo.Current.SaveUserInfo();
-                        }
+                        UserInfo.Current.appUnlockType.Add(faceIDUnlockType);
+                        UserInfo.Current.SaveUserInfo();
                     }
-                    else
-                    {
-                        if (UserInfo.Current.appUnlockType.Contains("3"))
-                        {
-                            UserInfo.Current.appUnlockType.Remove("3");
-                            UserInfo.Current.SaveUserInfo();
-                        }
-                    }
-                    MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
                 }
-                else// if (e == TouchIDUtils.TouchIDState.InputPassword || e == TouchIDUtils.TouchIDState.TouchIDLockout)
+                else
                 {
-                    ///灏嗛獙璇佹寚绾笽D鐨勯〉闈㈢Щ闄�
-                    MainPage.BasePageView.GetChildren(MainPage.BasePageView.ChildrenCount - 1).RemoveFromParent();
-                    
-                    GotogoToVerifyPasswordPage(optionType, refreshAction);
+                    if (UserInfo.Current.appUnlockType.Contains(faceIDUnlockType))
+                    {
+                        UserInfo.Current.appUnlockType.Remove(faceIDUnlockType);
+                        UserInfo.Current.SaveUserInfo();
+                    }
                 }
             };
+            
+            //璺宠浆鏁板瓧瀵嗙爜鎴栬�呮墜鍔垮瘑鐮侀獙璇侀〉闈�
+            Action goToVerifyPasswordAction = () =>
+            {
+                //鍏抽棴瑙i攣楠岃瘉
+                GotogoToVerifyPasswordPage(optionType, successAction);
+            };
+
+            FaceIDVerification_Show(successAction, goToVerifyPasswordAction);
+
         }
 
         /// <summary>
-        /// TouchID楠岃瘉 鍏抽棴瑙i攣璁剧疆
+        /// FaceID楠岃瘉 鍏抽棴瑙i攣璁剧疆
         /// </summary>
         /// <param name="action">楠岃瘉鎴愬姛浜嬩欢</param>
-        void TouchIDVerification_TurnOffUnlock(Action successAction)
+        void FaceIDVerification_TurnOffUnlock(Action successAction)
         {
-            //浣跨敤瀵嗙爜楠岃瘉
+            //璋冩暣鏁板瓧瀵嗙爜鎴栬�呮墜鍔垮瘑鐮侀獙璇侀〉闈�
             Action goToVerifyPasswordAction = () =>
             {
                 //鍏抽棴瑙i攣楠岃瘉
                 GotogoToVerifyPasswordPage("4", successAction);
             };
 
-            TouchIDUtils.Instance.showTouchIDWithDescribe(null, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
+            FaceIDVerification_Show(successAction, goToVerifyPasswordAction);
+        }
+
+        /// <summary>
+        /// 鎸囩汗ID缁熶竴寮瑰嚭
+        /// </summary>
+        /// <param name="optionType"></param>
+        /// <param name="successAction"></param>
+        /// <param name="goToVerifyPasswordAction"></param>
+        void TouchIDVerification_Show(Action successAction, Action goToVerifyPasswordAction)
+        {
+            //鎻愮ず鏁板瓧瀵嗙爜楠岃瘉杩樻槸缁樺埗鎵嬪娍楠岃瘉
+            string verificationTitleString = GetVerificationTitleString();
+
+            TouchIDUtils.Instance.showTouchIDWithDescribe(verificationTitleString, Language.StringByID(StringId.PleaseVerifyTheFingerprint));
             TouchIDUtils.Instance.OnHDLTouchIDStateBackEvent = (sender1, e) =>
             {
                 if (e == TouchIDUtils.TouchIDState.NotSupport)
@@ -491,6 +444,63 @@
         }
 
         /// <summary>
+        /// 鎸囩汗ID寮�鍚拰鍏抽棴 5:鎸囩汗ID寮�鍏�
+        /// </summary>
+        void TouchIDVerification_SwtichOnOff()
+        {
+            //鎸囩汗鍏抽棴鎴愬姛浜嬩欢 鎴愬姛浜嬩欢
+            Action successAction = () =>
+            {
+                var result = btnFingerprintUnlockSwtichIcon.IsSelected = !btnFingerprintUnlockSwtichIcon.IsSelected;
+                if (result)
+                {
+                    if (!UserInfo.Current.appUnlockType.Contains("3"))
+                    {
+                        UserInfo.Current.appUnlockType.Add("3");
+                        UserInfo.Current.SaveUserInfo();
+                    }
+                }
+                else
+                {
+                    if (UserInfo.Current.appUnlockType.Contains("3"))
+                    {
+                        UserInfo.Current.appUnlockType.Remove("3");
+                        UserInfo.Current.SaveUserInfo();
+                    }
+                }
+            };
+
+            //5:鎸囩汗ID寮�鍏�
+            string optionType = "5";
+            //璺宠浆鏁板瓧瀵嗙爜鎴栬�呮墜鍔垮瘑鐮侀獙璇侀〉闈�
+            Action goToVerifyPasswordAction = () =>
+            {
+                //5:鎸囩汗ID寮�鍏�
+                GotogoToVerifyPasswordPage(optionType, successAction);
+            };
+
+            
+
+            TouchIDVerification_Show(successAction, goToVerifyPasswordAction);
+        }
+
+        /// <summary>
+        /// TouchID楠岃瘉 4:鍏抽棴瑙i攣璁剧疆
+        /// </summary>
+        /// <param name="action">楠岃瘉鎴愬姛浜嬩欢</param>
+        void TouchIDVerification_TurnOffUnlock(Action successAction)
+        {
+            //璺宠浆鏁板瓧瀵嗙爜鎴栬�呮墜鍔垮瘑鐮侀獙璇侀〉闈�
+            Action goToVerifyPasswordAction = () =>
+            {
+                //4.鍏抽棴瑙i攣楠岃瘉
+                GotogoToVerifyPasswordPage("4", successAction);
+            };
+
+            TouchIDVerification_Show(successAction, goToVerifyPasswordAction);
+        }
+
+        /// <summary>
         /// 璺宠浆鎵嬪娍鎴栬�呭瘑鐮侀獙璇佺晫闈�
         /// </summary>
         /// <param name="optionType">1:璁剧疆瀵嗙爜锛�2:楠岃瘉瀵嗙爜;3:鍏抽棴瀵嗙爜;4:鍏抽棴瑙i攣璁剧疆;5:鎸囩汗ID寮�鍏筹紱6:闈㈠ID寮�鍏�;7:瑙i攣楠岃瘉</param>
@@ -512,5 +522,30 @@
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             }
         }
+
+        /// <summary>
+        /// 鍒ゆ柇鏄惁鏁板瓧楠岃瘉銆佸惁鍒欑粯鍒舵墜鍔块獙璇�
+        /// </summary>
+        /// <returns></returns>
+        bool CheckIfUnlockPassword()
+        {
+            return UserInfo.Current.appUnlockType.Contains("1");
+        }
+
+        /// <summary>
+        /// 鍒ゆ柇鏄惁鏁板瓧楠岃瘉銆佸惁鍒欑粯鍒舵墜鍔块獙璇�
+        /// </summary>
+        /// <returns></returns>
+        string GetVerificationTitleString()
+        {
+            if (CheckIfUnlockPassword())
+            {
+                return Language.StringByID(StringId.PasswordVerification);
+            }
+            else
+            {
+                return Language.StringByID(StringId.GestureVerification);
+            }
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0