From 737c036a39176fd2085ce82b7c60391da8cb508c Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期二, 31 十二月 2019 19:17:47 +0800 Subject: [PATCH] 合并了代码 --- ZigbeeApp/Shared/Common/Room.cs | 90 ++++++++++++++++++++++++++++++++------------- 1 files changed, 64 insertions(+), 26 deletions(-) diff --git a/ZigbeeApp/Shared/Common/Room.cs b/ZigbeeApp/Shared/Common/Room.cs index c6005c0..5d8d500 100755 --- a/ZigbeeApp/Shared/Common/Room.cs +++ b/ZigbeeApp/Shared/Common/Room.cs @@ -336,6 +336,19 @@ } } 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; @@ -770,31 +808,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 +943,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