From d72ca686a3e262693f8a6e45e747e8e8da43335b Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 06 七月 2021 09:39:03 +0800
Subject: [PATCH] 2021-07-06 1.更新

---
 HDL_ON/Entity/Room.cs |   51 ++++++++++++++++++++++++++-------------------------
 1 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs
index 055a4c6..df6eb59 100644
--- a/HDL_ON/Entity/Room.cs
+++ b/HDL_ON/Entity/Room.cs
@@ -74,10 +74,11 @@
         {
             var roomUpdateList = spatials.FindAll((obj) => obj.roomType == "ROOM");
             var floorUpdateList = spatials.FindAll((obj) => obj.roomType == "FLOOR");
+            CurrentSpatial.DeleteAllRoom();
+            FloorList.Clear();
             //澶勭悊鎴块棿鍒楄〃
             if (roomUpdateList != null && roomUpdateList.Count > 0)
             {
-                CurrentSpatial.DeleteAllRoom();
                 foreach (var newRoom in roomUpdateList)
                 {
                     newRoom.SaveRoomFile();
@@ -88,7 +89,6 @@
             //妤煎眰鎴块棿鍒楄〃
             if (floorUpdateList != null && floorUpdateList.Count > 0)
             {
-                FloorList.Clear();
                 foreach (var updateTemp in floorUpdateList)
                 {
                     FloorList.Add(updateTemp);
@@ -325,9 +325,10 @@
         /// </summary>
         public void DeleteAllRoom()
         {
-            foreach(var localRoom in RoomList)
+            for(int i=0;i< RoomList.Count;)
             {
-                Common.FileUtlis.Files.DeleteFile(localRoom.dataSavePath);
+                Common.FileUtlis.Files.DeleteFile(RoomList[i].dataSavePath);
+                RoomList.RemoveAt(i);
             }
             rooms = null;
         }
@@ -461,10 +462,10 @@
             }
         }
 
-        /// <summary>
-        /// 鎴块棿鍔熻兘鍒楄〃
-        /// </summary>
-        List<Function> functions = new List<Function>();
+        ///// <summary>
+        ///// 鎴块棿鍔熻兘鍒楄〃
+        ///// </summary>
+        //List<Function> functions = new List<Function>();
         /// <summary>
         /// 鑾峰彇鎴块棿鍔熻兘鍒楄〃
         /// </summary>
@@ -472,8 +473,8 @@
         {
             if (needRefresh)
             {
-                functions = new List<Function>();
             }
+            var functions = new List<Function>();
             if (functions.Count == 0)
             {
                 foreach (var f in FunctionList.List.GetDeviceFunctionList())
@@ -486,22 +487,22 @@
             }
             return functions;
         }
-        /// <summary>
-        /// 澧炲姞鎴块棿鍔熻兘
-        /// 鎿嶄綔鐨勬槸缂撳瓨鏁版嵁锛屼笉鐢ㄤ繚瀛�
-        /// </summary>
-        public void AddRoomFunction(Function function)
-        {
-            functions.Add(function);
-        }
-        /// <summary>
-        /// 鍒犻櫎鎴块棿鍔熻兘
-        /// 鎿嶄綔鐨勬槸缂撳瓨鏁版嵁锛屼笉鐢ㄤ繚瀛�
-        /// </summary>
-        public void RemoveRoomFunction(Function function)
-        {
-            functions.Remove(functions.Find((obj) => obj.sid == function.sid));
-        }
+        ///// <summary>
+        ///// 澧炲姞鎴块棿鍔熻兘
+        ///// 鎿嶄綔鐨勬槸缂撳瓨鏁版嵁锛屼笉鐢ㄤ繚瀛�
+        ///// </summary>
+        //public void AddRoomFunction(Function function)
+        //{
+        //    functions.Add(function);
+        //}
+        ///// <summary>
+        ///// 鍒犻櫎鎴块棿鍔熻兘
+        ///// 鎿嶄綔鐨勬槸缂撳瓨鏁版嵁锛屼笉鐢ㄤ繚瀛�
+        ///// </summary>
+        //public void RemoveRoomFunction(Function function)
+        //{
+        //    functions.Remove(functions.Find((obj) => obj.sid == function.sid));
+        //}
         /// <summary>
         /// 鎴块棿鍦烘櫙鍒楄〃
         /// </summary>

--
Gitblit v1.8.0