From b9cb076fe6127160c96c35bf9c8cebcffe1d5ccd Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 10 一月 2020 17:35:23 +0800
Subject: [PATCH] 2020.1.10

---
 ZigbeeApp/Shared/Common/Room.cs |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs
old mode 100755
new mode 100644
index d5612e4..d324988
--- a/ZigbeeApp/Shared/Common/Room.cs
+++ b/ZigbeeApp/Shared/Common/Room.cs
@@ -551,8 +551,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();
@@ -723,7 +736,7 @@
                 System.Console.WriteLine(ex.Message);
                 return null;
             }
-            
+
         }
         /// <summary>
         /// 鑾峰彇褰撳墠妤煎眰鐨勬埧闂村悕绉�
@@ -1386,10 +1399,10 @@
 
             if (sceneUI.IconPathType == 1 || sceneUI.IconPathType == 2)
             {
-                if (Global.IsExistsByHomeId(sceneUI.IconPath))
-                {
-                    Global.DeleteFilebyHomeId(sceneUI.IconPath);
-                    HdlAutoBackupLogic.DeleteFile(sceneUI.IconPath);
+                if (Global.IsExistsByHomeId(sceneUI.IconPath))
+                {
+                    Global.DeleteFilebyHomeId(sceneUI.IconPath);
+                    HdlAutoBackupLogic.DeleteFile(sceneUI.IconPath);
                 }
             }
 
@@ -1404,7 +1417,7 @@
             SceneUIList.Remove(sceneUI);
             SceneUIFilePathList.Remove(sceneUI.FileName);
             Save();
-            
+
             Global.DeleteFilebyHomeId(sceneUI.FileName);
             HdlAutoBackupLogic.DeleteFile(sceneUI.FileName);
         }

--
Gitblit v1.8.0