From 34e965100d635346e2d4cd6e6013bdaed66b3004 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期四, 02 一月 2020 19:52:13 +0800 Subject: [PATCH] 2019.1.2-3 --- ZigbeeApp/Shared/Common/Room.cs | 115 +++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 83 insertions(+), 32 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs old mode 100755 new mode 100644 index c6005c0..9db970d --- a/ZigbeeApp/Shared/Common/Room.cs +++ b/ZigbeeApp/Shared/Common/Room.cs @@ -69,7 +69,7 @@ /// <summary> /// 娓╁害浼犳劅鍣�(璁惧涓婚敭) - /// </summary> + /// </summary> public string TemperatrueDevice = string.Empty; /// <summary> /// 婀垮害浼犳劅鍣�(璁惧涓婚敭) @@ -78,11 +78,11 @@ /// <summary> /// 娓╁害 /// </summary> - public double Temperatrue; + public decimal Temperatrue; /// <summary> /// 婀垮害 /// </summary> - public double Humidity; + public decimal Humidity; /// <summary> /// 褰撳墠閫夋嫨鐨勬埧闂� @@ -332,10 +332,23 @@ room.Name = $"{room.Name}"; } Lists.Add(room); - + } } Config.Instance.Home.InitFloor(); + + RefreshRoomListView(); + } + + /// <summary> + /// 鍒锋柊鎴块棿瑙嗗浘鍒楄〃 + /// </summary> + public static void RefreshRoomListView() + { + Application.RunOnMainThread(() => + { + Phone.Device.Room.RoomManagement.Instance.Show(); + }); } /// <summary> @@ -445,8 +458,33 @@ //鍒犻櫎鏉ヨ嚜鎷嶇収鎴栬�呯郴缁熷浘搴撶殑鎴块棿鑳屾櫙鍥剧墖 if (room.BackgroundImageType == 1 || room.BackgroundImageType == 2) { - DeleteBackGroundIamageFilebyHomeId(room.BackgroundImage); + //鍒犻櫎鎺夊師鏉ョ殑鑷畾涔夊浘鐗� + if (Global.IsExistsByHomeId(room.BackgroundImage) == true) + { + Global.DeleteFilebyHomeId(room.BackgroundImage); + //鍒犻櫎澶囦唤 + HdlAutoBackupLogic.DeleteFile(room.BackgroundImage); + } } + //鎴戠殑鍠滅埍 + var loveRoom = this.GetLoveRoom(); + if (loveRoom != null) + { + //绉婚櫎鎴戠殑鍠滅埍閲岄潰鐨勮澶� + for (int i = 0; i < room.DeviceUIFilePathList.Count; i++) + { + loveRoom.DeviceUIFilePathList.Remove(room.DeviceUIFilePathList[i]); + loveRoom.DeviceUIList.RemoveAll((obj) => { return room.DeviceUIFilePathList[i] == obj.FileName; }); + } + //绉婚櫎鎴戠殑鍠滅埍閲岄潰鐨勫満鏅� + for (int i = 0; i < room.SceneUIFilePathList.Count; i++) + { + loveRoom.SceneUIFilePathList.Remove(room.SceneUIFilePathList[i]); + loveRoom.SceneUIList.RemoveAll((obj) => { return room.SceneUIFilePathList[i] == obj.FileName; }); + } + loveRoom.Save(false); + } + if (Global.IsExistsByHomeId(roomFilePath) == false) { return false; @@ -500,8 +538,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(); @@ -770,31 +821,6 @@ #endregion #region 鈼� 鎴块棿鑳屾櫙鍥剧殑鐩稿叧___________________ - /// <summary> - /// 鍒犻櫎鑳屾櫙鍥剧墖 - /// </summary> - /// <param name="fileName">fileName瀹為檯涓婂寘鍚簡浣忓畢璺姴 濡� 浣忓畢/鏂囦欢鍚�.</param> - public static void DeleteBackGroundIamageFilebyHomeId(string fileName) - { - if (fileName == null) - { - return; - } - var pathLists = fileName.Split('/'); - if (pathLists == null || pathLists.Count() < 9 || pathLists[8] == null) - { - return; - } - var path = System.IO.Path.Combine(Config.Instance.FullPath, fileName); - if (!Global.IsExistsByHomeId(pathLists[8])) - { - return; - } - //鍒犻櫎鏈湴鍥剧墖 - System.IO.File.Delete(path); - //鍒犻櫎澶囦唤 - Phone.UserCenter.HdlAutoBackupLogic.DeleteFile(pathLists[8]); - } /// <summary> /// 绉诲姩鑳屾櫙鍥剧墖鍒颁綇瀹呯洰褰曚笅 @@ -930,6 +956,31 @@ this.DeleteDevice(device); } + /// <summary> + /// 鍒犻櫎鎴戠殑鍠滅埍鐨勮澶� + /// </summary> + /// <param name="device">瑕佸垹闄ょ殑璁惧瀵硅薄</param> + public void DeleteLoveDevice(CommonDevice device) + { + if (device == null) + { + return; + } + //鎴戠殑鍠滅埍 + var loveRoom = this.GetLoveRoom(); + if (loveRoom != null) + { + string deviceFile = device.FilePath; + //绉婚櫎缂撳瓨 + if (loveRoom.DeviceUIFilePathList.Contains(deviceFile) == false) + { + return; + } + loveRoom.DeviceUIFilePathList.Remove(deviceFile); + loveRoom.DeviceUIList.RemoveAll((obj) => obj.FileName == deviceFile); + } + } + #endregion #region 鈼� 鑾峰彇璁惧_________________________ -- Gitblit v1.8.0