| | |
| | | get |
| | | { |
| | | List<DeviceUI> deviceList = new List<DeviceUI>(); |
| | | foreach (var room in Lists) |
| | | for (int i = 0; i < Lists.Count; i++) |
| | | { |
| | | var room = Lists[i]; |
| | | if (room.IsSharedRoom) |
| | | { |
| | | continue; |
| | |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var device in room.DeviceUIList) |
| | | for (int j = 0; j < room.DeviceUIList.Count; j++) |
| | | { |
| | | var device = room.DeviceUIList[j]; |
| | | if (device == null || device.CommonDevice == null) |
| | | { |
| | | continue; |
| | |
| | | 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(); |
| | |
| | | /// <param name="roomId">房间ID</param> |
| | | public Room GetRoomById(string roomId) |
| | | { |
| | | if (string.IsNullOrEmpty(roomId)) |
| | | { |
| | | return null; |
| | | } |
| | | return Lists.Find((obj) => obj.Id == roomId); |
| | | } |
| | | |
| | |
| | | deviceUI.DeviceAddr = device.DeviceAddr;
|
| | | deviceUI.DeviceEpoint = device.DeviceEpoint; |
| | | |
| | | return Lists.Find((obj) => obj.DeviceUIFilePathList.Contains(deviceUI.FileName)); |
| | | return Lists.Find((obj) => obj.IsLove == false && obj.DeviceUIFilePathList.Contains(deviceUI.FileName)); |
| | | } |
| | | |
| | | /// <summary> |