From 9ab5bd54fadd8fc9c542b48c99a117a4e182669b Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 14 十月 2021 16:37:56 +0800 Subject: [PATCH] 智能空开能源界面数据更新 --- HDL_ON/Entity/Room.cs | 75 ++++++++++++++++++++++++------------- 1 files changed, 48 insertions(+), 27 deletions(-) diff --git a/HDL_ON/Entity/Room.cs b/HDL_ON/Entity/Room.cs index 055a4c6..609e788 100644 --- a/HDL_ON/Entity/Room.cs +++ b/HDL_ON/Entity/Room.cs @@ -46,9 +46,10 @@ public SpatialInfo(string spatialType) { roomType = "FLOOR"; - parentId = DB_ResidenceData.Instance.CurrentRegion.RegionID; + parentId = DB_ResidenceData.Instance.CurrentRegion.id; } + public string homeId = ""; public string roomId = ""; public string roomName = ""; //public string roomImage = ""; @@ -56,6 +57,7 @@ public string roomType = ""; public string parentId = ""; public string uid = Guid.NewGuid().ToString(); + public string floorRoomName = ""; public string createTime = ""; public string modifyTime = ""; ///// <summary> @@ -74,10 +76,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 +91,6 @@ //妤煎眰鎴块棿鍒楄〃 if (floorUpdateList != null && floorUpdateList.Count > 0) { - FloorList.Clear(); foreach (var updateTemp in floorUpdateList) { FloorList.Add(updateTemp); @@ -110,6 +112,15 @@ { get { + if (MainPage.NoLoginMode) + { + if (floors == null) + { + floors = new List<SpatialInfo>(); + } + return floors; + } + if (floors == null) { try @@ -121,13 +132,14 @@ MainPage.Log(floorsDataString); floors = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SpatialInfo>>(floorsDataString); } - if (floors == null) + if(floors == null) { floors = new List<SpatialInfo>(); } } catch (Exception ex) { + floors = new List<SpatialInfo>(); MainPage.Log($"妤煎眰鏁版嵁鍒濆鍖栧け璐ワ細{ex.Message}"); } } @@ -242,6 +254,14 @@ { get { + if(MainPage.NoLoginMode ) + { + if (rooms == null) + { + rooms = new List<Room>(); + } + return rooms; + } if (rooms == null) { try @@ -325,9 +345,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 +482,10 @@ } } - /// <summary> - /// 鎴块棿鍔熻兘鍒楄〃 - /// </summary> - List<Function> functions = new List<Function>(); + ///// <summary> + ///// 鎴块棿鍔熻兘鍒楄〃 + ///// </summary> + //List<Function> functions = new List<Function>(); /// <summary> /// 鑾峰彇鎴块棿鍔熻兘鍒楄〃 /// </summary> @@ -472,8 +493,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 +507,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