From b800fbdf874cdc75ddc137ea2c22ac2c25d8b45c Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 26 十一月 2019 10:10:37 +0800
Subject: [PATCH] 2019.11.26

---
 ZigbeeApp/Shared/Common/Room.cs |   41 +++++++++++++++++++++++------------------
 1 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs
old mode 100755
new mode 100644
index 8279080..d410ead
--- a/ZigbeeApp/Shared/Common/Room.cs
+++ b/ZigbeeApp/Shared/Common/Room.cs
@@ -132,12 +132,6 @@
         public bool IsSharedRoom = false;
 
         /// <summary>
-        /// 鏄惁鍙互鍒锋柊鎴块棿鏁版嵁浜�
-        /// 闇�瑕佺瓑鍒濆鍖栨湰鍦拌澶囨暟鎹悗鍦ㄥ彲浠ュ垵濮嬪寲鎴块棿鏁版嵁
-        /// </summary>
-        public static bool CanInitAllRoom;
-
-        /// <summary>
         /// 鑾峰彇鍠滅埍鎴块棿鐨勬墍鏈夎澶囪矾寰�
         /// </summary>
         /// <value>The love room device list.</value>
@@ -282,10 +276,6 @@
         /// </summary>
         public static void InitAllRoom()
         {
-            //if (CanInitAllRoom == false)
-            //{
-            //    return;
-            //}
             Lists.Clear();
             if (Config.Instance.Home.RoomFilePathList.Contains("Room_Favorite.json") == false)
             {
@@ -305,11 +295,13 @@
                 {
                     if (room.IsSharedRoom)
                     {
-                        room.Name = $"({Language.StringByID(R.MyInternationalizationString.Shared)}){room.Name}";
+                        room.Name = $"{room.Name}";
                     }
                     Lists.Add(room);
+                   
                 }
             }
+            Config.Instance.Home.InitFloor();
         }
 
         /// <summary>
@@ -339,7 +331,6 @@
                 }
             }
             homeTemp.Save(false);
-            CanInitAllRoom = true;
             InitAllRoom();
         }
 
@@ -445,8 +436,21 @@
                     //璁惧锛坉eviceUI锛�
                     beforeRoom.DeviceUIList.Clear();
                     foreach (var deviceFilePath in beforeRoom.DeviceUIFilePathList)
-                    {
-                        beforeRoom.DeviceUIList.Add(Common.LocalDevice.Current.GetDeviceUI(deviceFilePath));
+                    {
+                        var jsonInfo = Encoding.UTF8.GetString(Global.ReadFileByHomeId(deviceFilePath));
+                        var tempDeviceUI = Newtonsoft.Json.JsonConvert.DeserializeObject<DeviceUI>(jsonInfo);
+                        if (tempDeviceUI != null)
+                        {
+                            var delCommon = tempDeviceUIList.Find((obj) => obj.CommonDevice != null && tempDeviceUI.CommonDevice != null && obj.CommonDevice.Type == tempDeviceUI.CommonDevice.Type && obj.CommonDevice.CommonDeviceAddrEpoint == tempDeviceUI.CommonDevice.CommonDeviceAddrEpoint);
+                            if (delCommon != null)
+                            {
+                                beforeRoom.DeviceUIList.Add(delCommon);
+                            }
+                            else
+                            {
+                                beforeRoom.AddDevice(deviceFilePath);
+                            }
+                        }
                     }
                     //鍦烘櫙(SceneUI)
                     beforeRoom.SceneUIList.Clear();
@@ -765,8 +769,9 @@
         public void AddDevice(string deviceUIFilePath)
         {
             if (string.IsNullOrEmpty(deviceUIFilePath))
-            {
-                return;
+
+             {
+                 return;
             }
             var deviceUI = Common.LocalDevice.Current.GetDeviceUI(deviceUIFilePath);
             if (null == deviceUI.CommonDevice)
@@ -994,7 +999,7 @@
                     return -1;
                 }
             }
-            
+
             var getSceneIdAllData = await ZigBee.Device.Scene.GetSceneNewIdAsync(sceneName);
             if (getSceneIdAllData == null || getSceneIdAllData.getSceneIdData == null)
             {
@@ -1480,6 +1485,6 @@
         }
 
         #endregion
-       
+
     }
 }

--
Gitblit v1.8.0