From 2bf5ec775cb57d8015bee58c745a1e48081ff1b1 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期二, 15 十月 2019 11:06:05 +0800 Subject: [PATCH] 首次合并了全部的代码 --- ZigbeeApp/Shared/Common/Room.cs | 52 ++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 36 insertions(+), 16 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs index c7ef0ed..d29e34b 100755 --- a/ZigbeeApp/Shared/Common/Room.cs +++ b/ZigbeeApp/Shared/Common/Room.cs @@ -36,7 +36,7 @@ /// 妤煎眰Id /// 鏂板鏃朵娇鐢℅uid /// </summary> - public string FloorId = "Floor1"; + public string FloorId = string.Empty; /// <summary> /// 妤煎眰鍚嶇О /// </summary> @@ -66,6 +66,15 @@ /// 妤煎眰--澶囩敤 /// </summary> public Dictionary<string, string> FloorList = new Dictionary<string, string> { }; + + /// <summary> + /// 娓╁害浼犳劅鍣�(璁惧涓婚敭) + /// </summary> + public string TemperatrueDevice = string.Empty; + /// <summary> + /// 婀垮害浼犳劅鍣�(璁惧涓婚敭) + /// </summary> + public string HumidityDevice = string.Empty; /// <summary> /// 褰撳墠閫夋嫨鐨勬埧闂� @@ -373,21 +382,8 @@ //璁惧锛坉eviceUI锛� beforeRoom.DeviceUIList.Clear(); foreach (var deviceFilePath in beforeRoom.DeviceUIFilePathList) - { - 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); - } - } + { + beforeRoom.DeviceUIList.Add(Common.LocalDevice.Current.GetDeviceUI(deviceFilePath)); } //鍦烘櫙(SceneUI) beforeRoom.SceneUIList.Clear(); @@ -807,6 +803,28 @@ AllRoomDeviceTypeList.Add(deviceUI.CommonDevice.Type); } } + } + + /// <summary> + /// 鑾峰彇褰撳墠鎴块棿涓嬬殑鍏ㄩ儴璁惧 + /// </summary> + /// <returns></returns> + public List<CommonDevice> GetRoomListDevice() + { + var listDevice = new List<CommonDevice>(); + foreach (var device in this.DeviceUIList) + { + if (device == null || device.CommonDevice == null) + { + continue; + } + listDevice.Add(device.CommonDevice); + } + if (listDevice.Count == 0) + { + return listDevice; + } + return Common.LocalDevice.Current.SortDevice(listDevice); } #endregion @@ -1282,6 +1300,8 @@ //鍏嬮殕灞炴�� newRoom.Id = this.Id; newRoom.FloorId = this.FloorId; + newRoom.TemperatrueDevice = this.TemperatrueDevice; + newRoom.HumidityDevice = this.HumidityDevice; newRoom.Name = this.Name; newRoom.BackgroundImage = this.BackgroundImage; newRoom.BackgroundImageType = this.BackgroundImageType; -- Gitblit v1.8.0