From 9ed4d6675aa1f0abe20e3f84e92f5ac2da8ab4f4 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期六, 12 十二月 2020 20:02:00 +0800
Subject: [PATCH] 20201212-4

---
 HDL_ON/Entity/DB_ResidenceData.cs |   59 ++++++++++++++++++++++++++++-------------------------------
 1 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/HDL_ON/Entity/DB_ResidenceData.cs b/HDL_ON/Entity/DB_ResidenceData.cs
index ed3d96a..aacf16e 100644
--- a/HDL_ON/Entity/DB_ResidenceData.cs
+++ b/HDL_ON/Entity/DB_ResidenceData.cs
@@ -25,7 +25,7 @@
             {
                 if (MainPage.NoLoginMode)
                 {
-                    return new RegionInfoRes() { Name = "鏈湴妯″紡" };
+                    return new RegionInfoRes() { Name = "鏈湴妯″紡" , };
                 }
                 else
                 {
@@ -35,9 +35,6 @@
                         if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0)
                         {
                             UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID;
-                            //鎭㈠澶囦唤
-                            //HDLCommon.Current.RestoreHomeBackup(CurReginID);
-
                             return UserInfo.Current.regionList[0];
                         }
                         else
@@ -127,6 +124,8 @@
                     catch (Exception ex)
                     {
                         MainPage.Log($"浣忓畢鏁版嵁鍒濆鍖栧け璐ワ細{ex.Message}");
+                        instance = new DB_ResidenceData { };
+                        return instance;
                     }
                     instance.residenceImage = "Classification/Room/Roombg.png";
                     //鍒濆鍖栦綇瀹呭姛鑳芥暟鎹�
@@ -142,10 +141,10 @@
         public void EixtAccount()
         {
             instance = null;
-            Rooms = null;
             ins_OidList = null;
-            functionList = null;
             HomeGateway = null;
+            SpatialInfo.CurrentSpatial.ClearRooms();
+            FunctionList.List.Clear();
             if (MainPage.IsRemote)
             {
                 DAL.Mqtt.MqttClient.DisConnectRemote("閫�鍑虹櫥褰曪紝鎴栬�呭垏鎹綇瀹�");
@@ -180,6 +179,24 @@
                 }
             }
         }
+
+        /// <summary>
+        /// 妫�娴嬩綇瀹呮槸鍚︾粦瀹氫簡缃戝叧
+        /// gatewayId 鍒ょ┖
+        /// </summary>
+        /// <returns></returns>
+        public bool CheckWhetherGatewayIdIsNull()
+        {
+            if (HomeGateway != null && !string.IsNullOrEmpty(HomeGateway.gatewayId))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+
         /// <summary>
         /// 妫�娴嬩綇瀹呮槸鍚︾粦瀹氫簡缃戝叧
         /// </summary>
@@ -243,7 +260,6 @@
                 return;
             var ssd = System.Text.Encoding.UTF8.GetBytes(Newtonsoft.Json.JsonConvert.SerializeObject(this));
             Common.FileUtlis.Files.WriteFileByBytes("DB_ResidenceData", ssd);
-            MainPage.Log("Save DB_ResidenceData");
         }
 
         /// <summary>
@@ -251,30 +267,11 @@
         /// </summary>
         public string CurFoor = Language.StringByID(StringId.All);
 
-        /// <summary>
-        /// 鎴块棿鍒楄〃
-        /// </summary>
-        public List<Room> Rooms = SpatialInfo.CurrentSpatial.RoomList;
-
-        #region 鍔熻兘鏁版嵁
-        static FunctionList _functionList;
-        public static FunctionList functionList
-        {
-            get
-            {
-                if (_functionList == null)
-                {
-                    _functionList = FunctionList.List;
-                }
-                return _functionList;
-            }
-            set
-            {
-                _functionList = value;
-            }
-        }
-
-        #endregion
+        ///// <summary>
+        ///// 鎴块棿鍒楄〃
+        ///// </summary>
+        //[Newtonsoft.Json.JsonIgnore]
+        //public List<Room> Rooms = SpatialInfo.CurrentSpatial.RoomList;
 
         #region oid鍒楄〃 a鍗忚杞琤us鍗忚鎺у埗浣跨敤
         /// <summary>

--
Gitblit v1.8.0