From 163777d8a2cb7cfa469f54a7042528870ebc10a3 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 09 十二月 2019 17:46:20 +0800
Subject: [PATCH] 一个新版本

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs |  101 ++++++++++++++++++++++++++++----------------------
 1 files changed, 57 insertions(+), 44 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
index 319918d..41f14f5 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
@@ -639,11 +639,6 @@
                 }
                 catch { }
 
-                if (noticeDb == true)
-                {
-                    //閫氱煡浜戠锛屽凡缁忛��鍑虹櫥闄�
-                    var result = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/SignOut", null, "GET");
-                }
                 HdlThreadLogic.Current.RunMain(() =>
                 {
                     //鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
@@ -654,6 +649,12 @@
                     Shared.Common.CommonPage.Instance.AddChidren(formLogin);
                     formLogin.Show(account);
                 });
+
+                if (noticeDb == true)
+                {
+                    //閫氱煡浜戠锛屽凡缁忛��鍑虹櫥闄�
+                    var result = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync("ZigbeeUsers/SignOut", null, "GET");
+                }
             });
         }
 
@@ -800,7 +801,9 @@
         /// <summary>
         /// 寮傛鏂规硶鎵ц(浠呴檺鍒囨崲浣忓畢鏃惰皟鐢�)锛屽埛鏂颁釜浜轰腑蹇冪殑鍐呭瓨鍙婄嚎绋�
         /// </summary>
-        public async static Task<bool> InitUserCenterMenmoryAndThread()
+        /// <param name="ShowPrompted">鏂拌拷鍔犲彉閲忥細鏄惁鏄剧ず鎻愮ず鑷姩澶囦唤鐨勭晫闈�</param>
+        /// <returns></returns>
+        public async static Task<bool> InitUserCenterMenmoryAndThread(bool ShowPrompted = true)
         {
             //APP缂撳瓨鍔犺浇寮�濮�
             UserCenterResourse.Option.AppCanSignout = false;
@@ -831,6 +834,8 @@
                 {
                     //閲嶆柊鍙戦�佸懡浠ゅ幓缁戝畾鏂綉鎯呭喌涓嬪浠界殑缃戝叧
                     HdlGatewayLogic.Current.ResetComandToBindBackupGateway();
+                    //璇诲彇闅愬尶閰嶇疆
+                    await HdlBackupLogic.Current.LoadHideOption();
                 }
 
                 //鍒濆鍖栫紦瀛樻垚鍛樼殑淇℃伅
@@ -878,7 +883,7 @@
                 HdlGatewayLogic.Current.RefreshAppOldSelectGatewayId();
 
                 //0:宸茬粡鍚屾杩囷紝涓嶉渶瑕佸悓姝�,杩欎釜鏃跺�欓渶瑕佹彁绀哄浠�
-                if (result == 0)
+                if (result == 0 && ShowPrompted == true)
                 {
                     //寮�鍚嚜鍔ㄥ浠芥彁绀�
                     HdlAutoBackupLogic.ShowAutoBackupPromptedForm();
@@ -1226,24 +1231,28 @@
         /// <returns></returns>
         public static string EncryptPassword(string keys, string strPsw)
         {
-            if (strPsw == string.Empty)
+            try
             {
-                return strPsw;
+                if (strPsw == string.Empty)
+                {
+                    return strPsw;
+                }
+                var des = new System.Security.Cryptography.DESCryptoServiceProvider();
+                byte[] inputByteArray = Encoding.Default.GetBytes(strPsw);
+                des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
+                des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
+                var ms = new System.IO.MemoryStream();
+                var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
+                cs.Write(inputByteArray, 0, inputByteArray.Length);
+                cs.FlushFinalBlock();
+                StringBuilder ret = new StringBuilder();
+                foreach (byte b in ms.ToArray())
+                {
+                    ret.AppendFormat("{0:X2}", b);
+                }
+                return ret.ToString().ToLower();
             }
-            var des = new System.Security.Cryptography.DESCryptoServiceProvider();
-            byte[] inputByteArray = Encoding.Default.GetBytes(strPsw);
-            des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
-            des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
-            var ms = new System.IO.MemoryStream();
-            var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateEncryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
-            cs.Write(inputByteArray, 0, inputByteArray.Length);
-            cs.FlushFinalBlock();
-            StringBuilder ret = new StringBuilder();
-            foreach (byte b in ms.ToArray())
-            {
-                ret.AppendFormat("{0:X2}", b);
-            }
-            return ret.ToString();
+            catch { return strPsw; }
         }
 
         /// <summary>
@@ -1253,29 +1262,33 @@
         /// <returns></returns>
         public static string DecryptPassword(string keys, string strPsw)
         {
-            if (strPsw == string.Empty)
+            try
             {
-                return strPsw;
+                if (strPsw == string.Empty)
+                {
+                    return strPsw;
+                }
+                var des = new System.Security.Cryptography.DESCryptoServiceProvider();
+
+                byte[] inputByteArray = new byte[strPsw.Length / 2];
+                for (int x = 0; x < strPsw.Length / 2; x++)
+                {
+                    int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16));
+                    inputByteArray[x] = (byte)i;
+                }
+
+                des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
+                des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
+                var ms = new System.IO.MemoryStream();
+                var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
+                cs.Write(inputByteArray, 0, inputByteArray.Length);
+                cs.FlushFinalBlock();
+
+                StringBuilder ret = new StringBuilder();
+
+                return System.Text.Encoding.Default.GetString(ms.ToArray());
             }
-            var des = new System.Security.Cryptography.DESCryptoServiceProvider();
-
-            byte[] inputByteArray = new byte[strPsw.Length / 2];
-            for (int x = 0; x < strPsw.Length / 2; x++)
-            {
-                int i = (Convert.ToInt32(strPsw.Substring(x * 2, 2), 16));
-                inputByteArray[x] = (byte)i;
-            }
-
-            des.Key = ASCIIEncoding.ASCII.GetBytes(keys);
-            des.IV = ASCIIEncoding.ASCII.GetBytes(keys);
-            var ms = new System.IO.MemoryStream();
-            var cs = new System.Security.Cryptography.CryptoStream(ms, des.CreateDecryptor(), System.Security.Cryptography.CryptoStreamMode.Write);
-            cs.Write(inputByteArray, 0, inputByteArray.Length);
-            cs.FlushFinalBlock();
-
-            StringBuilder ret = new StringBuilder();
-
-            return System.Text.Encoding.Default.GetString(ms.ToArray());
+            catch { return strPsw; }
         }
         #endregion
 

--
Gitblit v1.8.0