From dce6c3481a37216292724013ff9d2b75ceb82f86 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 10 六月 2020 15:47:28 +0800
Subject: [PATCH] 添加小度的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs |   60 +++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
index 3d10478..c78a7f6 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Logic/UserCenterLogic.cs
@@ -95,6 +95,10 @@
                 }
             }
             var revertObj = JsonConvert.DeserializeObject<ResponsePack>(Encoding.UTF8.GetString(byteData));
+            if (revertObj == null)
+            {
+                return "Error";
+            }
             return revertObj.StateCode;
         }
 
@@ -143,7 +147,7 @@
             }
             if (revertObj == null || revertObj.ResponseData == null)
             {
-                return string.Empty;
+                return null;
             }
             return revertObj.ResponseData.ToString();
         }
@@ -423,9 +427,10 @@
                     int index = UserCenterResourse.listActionFormId.IndexOf(UserCenterResourse.NowActionFormID) - 1;
                     //鍒濆鍊�
                     UserCenterResourse.NowActionFormID = string.Empty;
+                    var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
+
                     if (index >= 0)
                     {
-                        var actionForm = UserView.HomePage.Instance.GetChildren(UserView.HomePage.Instance.ChildrenCount - 1);
                         if (actionForm != null && actionForm is CommonFormBase)
                         {
                             string formId = ((CommonFormBase)actionForm).FormID;
@@ -436,16 +441,12 @@
                                 CallFormActionAgainEvent(form, index);
                             }
                         }
-                        else if (actionForm != null && actionForm is UserView.UserPage)
-                        {
-                            //杩欓噷瀹冨凡缁忛��鍒颁富椤典簡
-                            if (UserCenterResourse.listActionFormId.Contains("UserMainForm") == true//涓汉涓績
-                                || UserCenterResourse.listActionFormId.Contains("HomeMainPageForm") == true)//
-                            {
-                                //璋冪敤鐣岄潰閲嶆柊婵�娲荤殑鍑芥暟
-                                CallFormActionAgainEvent(form, index);
-                            }
-                        }
+                    }
+                    else if (actionForm != null && actionForm is UserView.UserPage)
+                    {
+                        //杩欓噷瀹冨凡缁忛��鍒颁富椤典簡
+                        var nowForm = UserView.UserPage.Instance.GetNowActionForm();
+                        nowForm?.FormActionAgainEvent();
                     }
                 }
                 //绉婚櫎ID
@@ -559,7 +560,7 @@
             double Longitude = Config.Instance.Home.Longitude;
             double Latitude = Config.Instance.Home.Latitude;
             //杩樺師浣忓畢瀵硅薄
-            Config.Instance.Home = House.GetHouseByHouseId(Config.Instance.Home.Id);
+            Config.Instance.Home = HdlResidenceLogic.Current.GetHouseByHouseId(Config.Instance.Home.Id);
             Config.Instance.Home.IsOthreShare = isOthreShare;
             Config.Instance.Home.AccountType = accountType;
             Config.Instance.Home.MainUserDistributedMark = mainMark;
@@ -677,12 +678,12 @@
                 //娓呯┖褰撳墠浣忓畢id
                 Config.Instance.HomeId = string.Empty;
                 HdlGatewayLogic.Current.ClearAllRealGateway();
-                try
+
+                //鏂紑杩滅▼Mqtt杩炴帴
+                HdlThreadLogic.Current.RunThread(async () =>
                 {
-                    //鏂紑杩滅▼Mqtt杩炴帴
-                    ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
-                }
-                catch { }
+                    await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
+                }, ShowErrorMode.NO);
 
                 HdlThreadLogic.Current.RunMain(() =>
                 {
@@ -872,12 +873,11 @@
             if (Common.Config.Instance.HomeId != UserCenterResourse.AccountOption.OldHomeStringId
                 || Common.Config.Instance.Account != UserCenterResourse.AccountOption.OldAccountId)
             {
-                try
+                //鏂紑杩滅▼Mqtt杩炴帴
+                HdlThreadLogic.Current.RunThread(async () =>
                 {
-                    //鏂紑杩滅▼Mqtt杩炴帴
                     await ZigBee.Device.ZbGateway.DisConnectRemoteMqttClient();
-                }
-                catch { }
+                }, ShowErrorMode.NO);
 
                 //娓呯┖鎵�鏈夋垚鍛樼紦瀛�
                 ClearAllMemberMemory();
@@ -929,7 +929,7 @@
                 //鍒濆鍖栨湰鍦扮殑缃戝叧淇℃伅
                 HdlGatewayLogic.Current.ReFreshByLocal();
                 //鍒濆鍖栨湰鍦扮殑璁惧淇℃伅
-                Common.LocalDevice.Current.ReFreshByLocal();
+                LocalDevice.Current.ReFreshByLocal();
 
                 //鍒濆鍖栨埧闂�(閮洩鍩庨偅杈逛笉鍋氬鐞�,闇�瑕佽繖閲岀壒娈婃墽琛屼竴姝�)
                 HdlRoomLogic.Current.RefreshAllRoomByLocation();
@@ -1501,14 +1501,24 @@
         #region 鈻� 鏂囦欢淇濆瓨鍜岃鍙朹____________________
 
         /// <summary>
-        /// 鏂囦欢淇濆瓨,浠呴檺褰撳墠浣忓畢(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺)
+        /// 鏂囦欢淇濆瓨(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺)
         /// </summary>
         /// <param name="fullName">鍏ㄨ矾寰�</param>
         /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param>
         public static void SaveFileContent(string fullName, object obj)
         {
             var data = JsonConvert.SerializeObject(obj);
-            var byteData = Encoding.UTF8.GetBytes(data);
+            SaveTexToFile(fullName, data);
+        }
+
+        /// <summary>
+        /// 鏂囦欢淇濆瓨(鏁村ぉ蹇樿,鎵�浠ュ缓涓�涓嚱鏁版潵鐜╃帺)
+        /// </summary>
+        /// <param name="fullName">鍏ㄨ矾寰�</param>
+        /// <param name="obj">闇�瑕佸簭鍒楀寲鐨勪笢瑗�</param>
+        public static void SaveTexToFile(string fullName, string textValue)
+        {
+            var byteData = Encoding.UTF8.GetBytes(textValue);
             //鍐欏叆鍐呭
             System.IO.FileStream fileStream = null;
             try

--
Gitblit v1.8.0