From f759dc1e6f49c53733eafda82207c85af18f9931 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 28 五月 2020 15:46:54 +0800
Subject: [PATCH] 2020-05-28-1

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs |   75 +++++++++++++++++++++++++++----------
 1 files changed, 54 insertions(+), 21 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
index 421cd93..2f3c31e 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
@@ -470,24 +470,28 @@
                 try
                 {
                     var Myform = UserCenterResourse.DicActionForm[UserCenterResourse.NowActionFormID] as EditorCommonForm;
-                    //閲嶇疆宸︽粦浣胯兘
-                    Myform.ScrollEnabled = Myform.ScrollEnabled;
-                    //瑙﹀彂鐣岄潰鍐嶆婵�娲荤殑浜嬩欢
-                    int value = Myform.FormActionAgainEvent();
-                    if (value == 1)
+                    //鐐瑰嚮寰堝揩鏃�,杩欎釜涓滆タ浼氭槸null,浣嗘槸DicActionForm閲岄潰涓嶆槸null,涓嶇煡閬撲负浠�涔�
+                    if (Myform != null)
                     {
-                        //Log鍑哄姏
-                        HdlLogLogic.Current.WriteLog(1, Myform.FormID + " 琚縺娲�");
+                        //閲嶇疆宸︽粦浣胯兘
+                        Myform.ScrollEnabled = Myform.ScrollEnabled;
+                        //瑙﹀彂鐣岄潰鍐嶆婵�娲荤殑浜嬩欢
+                        int value = Myform.FormActionAgainEvent();
+                        if (value == 1)
+                        {
+                            //Log鍑哄姏
+                            HdlLogLogic.Current.WriteLog(1, Myform.FormID + " 琚縺娲�");
+                        }
                     }
                 }
                 catch (Exception ex)
                 {
                     //鍑虹幇鏈煡閿欒,鏁版嵁涓㈠け
-                    var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
-                    alert.Show();
+                    //var alert = new ShowMsgControl(ShowMsgType.Error, Language.StringByID(R.MyInternationalizationString.uUnKnownError));
+                    //alert.Show();
 
                     //Log鍑哄姏
-                    HdlLogLogic.Current.WriteLog(ex, "鐣岄潰閲嶆柊婵�娲诲紓甯�");
+                    HdlLogLogic.Current.WriteLog(ex, "鐣岄潰閲嶆柊婵�娲诲紓甯� " + UserCenterResourse.NowActionFormID);
                 }
             }
         }
@@ -636,13 +640,16 @@
                 //濡傛灉鏄櫄鎷熶綇瀹�
                 HdlThreadLogic.Current.RunMain(() =>
                 {
+                    //璁惧畾涓�涓椂闂�
+                    Config.Instance.LoginDateTime = new DateTime(1970, 1, 1);
+                    Config.Instance.Save();
                     //鏀惰捣宸﹁彍鍗�
                     CommonPage.Instance.CloseLeftMenu();
                     //鍏抽棴鎵�鏈夋墦寮�浜嗙殑鐣岄潰
                     CloseAllOpenForm();
 
                     //鏄剧ず鐧婚檰鐢婚潰
-                    var formLogin = new Login.AccountLogin();
+                    var formLogin = new Login.AccountLoginForm();
                     Shared.Common.CommonPage.Instance.AddChidren(formLogin);
                     formLogin.ShowForm(account);
                 });
@@ -683,7 +690,7 @@
                     CloseAllOpenForm();
 
                     //鏄剧ず鐧婚檰鐢婚潰
-                    var formLogin = new Login.AccountLogin();
+                    var formLogin = new Login.AccountLoginForm();
                     Shared.Common.CommonPage.Instance.AddChidren(formLogin);
                     formLogin.ShowForm(account);
                 });
@@ -832,6 +839,9 @@
         /// <returns></returns>
         public async static Task<bool> InitUserCenterMenmoryAndThread(bool ShowPrompted = true)
         {
+            //璋冪敤杩欎釜鏂规硶,閮介渶瑕侀噸鏂板埛鏂颁富椤�
+            UserView.UserPage.Instance.RefreshForm = true;
+
             //濡傛灉鏄櫄鎷熶綇瀹�
             if (Config.Instance.Home.IsVirtually == true)
             {
@@ -869,7 +879,7 @@
                 UserCenterResourse.ResidenceOption = UserCenterResourse.ResidenceOption.Load();
 
                 //鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅
-                var hadNet = await InitUserAccoutInfo();
+                var hadNet = await InitUserAccoutInfo(true);
                 //濡傛灉鏈夌綉缁滅殑璇�
                 if (hadNet == true)
                 {
@@ -940,6 +950,7 @@
         /// </summary>
         private static void InitUserCenterMenmoryByVirtualHome()
         {
+            UserCenterResourse.AccountOption.OldHomeStringId = Common.Config.Instance.Home.Id;
             //娓呯┖鎵�鏈夋垚鍛樼紦瀛�
             ClearAllMemberMemory();
             //棰勫垱寤轰釜浜轰腑蹇冨叏閮ㄧ殑鏂囦欢澶�
@@ -952,6 +963,8 @@
             Common.LocalDevice.Current.ReFreshByLocal();
             //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�)
             HdlRoomLogic.Current.RefreshAllRoomByLocation();
+            //鍒锋柊宸﹁竟鍒锋柊鎴块棿瑙嗗浘鍒楄〃
+            HdlRoomLogic.Current.RefreshRoomListView();
         }
 
         /// <summary>
@@ -975,6 +988,11 @@
             UserCenterResourse.ResidenceOption.HomeMainPageSwitchIndex = 1;
             //褰撳墠鍒嗙被,鍦烘櫙鍜屽姛鑳芥墍閫夋嫨鐨勫垎鏀� 0:鍦烘櫙 1:鍔熻兘 2:鑷姩鍖�
             UserCenterResourse.ResidenceOption.CategoryPageSwitchIndex = 0;
+
+            //鍒囨崲浣忓畢娓呴櫎涔嬪墠閫昏緫缂撳瓨鏁版嵁;
+            Common.Logic.LogicList.Clear();
+            Common.Logic.LockLogicList.Clear();
+            Common.Logic.SoneLogicList.Clear();
         }
 
         #endregion
@@ -984,14 +1002,18 @@
         /// <summary>
         /// 鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅
         /// </summary>
+        /// <param name="reLoad">鏄惁浠庢柊浠庢湰鍦板姞杞�(閲嶆柊鍒濆鍖栫櫥闄嗚处鍙风殑淇℃伅,涓嶉渶瑕侀噸鏂板姞杞�)</param>
         /// <returns></returns>
-        private async static Task<bool> InitUserAccoutInfo()
+        private async static Task<bool> InitUserAccoutInfo(bool reLoad)
         {
             //鍒濆鍖栦釜浜轰俊鎭殑鏍囪瘑
             UserCenterResourse.UserInfo.InitUserInfoSuccess = false;
-            //鑾峰彇鏈湴璁板綍鐨勭敤鎴蜂俊鎭�
-            UserCenterResourse.UserInfo = GetUserInformationFromLocation();
-            UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
+            if (reLoad == true)
+            {
+                //鑾峰彇鏈湴璁板綍鐨勭敤鎴蜂俊鎭�
+                UserCenterResourse.UserInfo = GetUserInformationFromLocation();
+                UserCenterResourse.UserInfo.UserIconFile = System.IO.Path.Combine(UserCenterResourse.AccountOption.UserPictruePath, "Admin.png");
+            }
 
             //鑾峰彇鐧诲綍璐﹀彿鐨勪俊鎭�
             var pra = new AccountInfoPra();
@@ -1114,7 +1136,7 @@
         private async static Task<bool> ReInitUserAccoutInfo()
         {
             //閲嶆柊鍒濆鍖栬处鍙蜂俊鎭�
-            var result = await InitUserAccoutInfo();
+            var result = await InitUserAccoutInfo(false);
             if (result == false)
             {
                 return result;
@@ -1461,10 +1483,21 @@
         /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param>
         public static void SaveFileContent(string fullName, object obj)
         {
-            var data = Newtonsoft.Json.JsonConvert.SerializeObject(obj);
-            var byteData = System.Text.Encoding.UTF8.GetBytes(data);
+            var data = JsonConvert.SerializeObject(obj);
+            var byteData = Encoding.UTF8.GetBytes(data);
             //鍐欏叆鍐呭
-            Shared.IO.FileUtils.WriteFileByBytes(fullName, byteData);
+            System.IO.FileStream fileStream = null;
+            try
+            {
+                fileStream = new System.IO.FileStream(fullName, System.IO.FileMode.Create, System.IO.FileAccess.Write);
+                fileStream.Write(byteData, 0, byteData.Length);
+                fileStream.Flush();
+            }
+            catch { }
+            finally
+            {
+                fileStream?.Close();
+            }
         }
 
         /// <summary>

--
Gitblit v1.8.0