| | |
| | | } |
| | | Save(); |
| | | HdlAutoBackupLogic.AddOrEditorFile(room.FileName); |
| | | CurrentRoom.RefreshRoomListView(); |
| | | return true; |
| | | } |
| | | |
| | |
| | | { |
| | | foreach (var r in Lists) |
| | | { |
| | | if(r.IsLove) |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var scene in r.SceneUIList) |
| | | { |
| | | if (scene.Id == sceneId) |
| | |
| | | List<DeviceUI> deviceUIs = new List<DeviceUI> { }; |
| | | var dList = AllRoomDeviceUIList; |
| | | var commonDeviceList = Common.LocalDevice.Current.listAllDevice; |
| | | |
| | | if (dList.Count == 0) |
| | | { |
| | | return null; |
| | | } |
| | | |
| | | foreach (var device in commonDeviceList) |
| | | { |
| | | if (dList.Find((obj) => obj.CommonDevice == device) == null) |
| | | if (dList.Find((obj) => obj.CommonDevice.DeviceEpoint == device.DeviceEpoint && obj.CommonDevice.DeviceAddr == device.DeviceAddr) == null) |
| | | { |
| | | deviceUIs.Add(Common.LocalDevice.Current.GetDeviceUI(device)); |
| | | } |
| | |
| | | { |
| | | foreach (var r in Lists) |
| | | { |
| | | if (r.IsLove) |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var sceneUI in r.SceneUIList) |
| | | { |
| | | if (sceneUI.Id == sceneId) |
| | |
| | | /// </summary> |
| | | public async System.Threading.Tasks.Task<bool> RefreshSceneUIList() |
| | | { |
| | | return false; |
| | | //System.Console.WriteLine($"开始请求网关场景****{DateTime.Now.ToString("yyMMdd hhmmss fff")}*****"); |
| | | //bool result = true; |
| | | //var sceneList = await ZigBee.Device.Scene.GetSceneListAsync(); |
| | | //System.Console.WriteLine($"结束请求网关场景****{DateTime.Now.ToString("yyMMdd hhmmss fff")}*****"); |
| | | //if (sceneList == null) |
| | | //{ |
| | | // return false; |
| | | //} |
| | | //List<int> sceneIDList = new List<int> { }; |
| | | //System.Console.WriteLine($"开始本地场景****{DateTime.Now.ToString("yyMMdd hhmmss fff")}*****"); |
| | | //foreach (var scene in sceneList) |
| | | //{ |
| | | // if (scene == null) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // sceneIDList.Add(scene.ScenesId); |
| | | //} |
| | | //foreach(var r in Lists) |
| | | //{ |
| | | // if(r.SceneUIList==null || r.SceneUIList.Count==0) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // foreach(var rScene in r.SceneUIList) |
| | | // { |
| | | // if(rScene==null) |
| | | // { |
| | | // continue; |
| | | // } |
| | | // //var scene = sceneList.Find((obj) => rScene.ScenesId == obj.ScenesId); |
| | | // if(sceneIDList.Contains(rScene.ScenesId)==false) |
| | | // { |
| | | // var removeResult = r.SceneUIList.Remove(rScene); |
| | | // r.Save(); |
| | | // if (removeResult == false) |
| | | // { |
| | | // result = false; |
| | | // } |
| | | // } |
| | | // } |
| | | //} |
| | | //System.Console.WriteLine($"结束本地场景****{DateTime.Now.ToString("yyMMdd hhmmss fff")}*****"); |
| | | //return result; |
| | | bool result = true; |
| | | var sceneList = await ZigBee.Device.Scene.GetSceneListAsync(); |
| | | if (sceneList == null) |
| | | { |
| | | return false; |
| | | } |
| | | List<int> sceneIDList = new List<int> { }; |
| | | foreach (var scene in sceneList) |
| | | { |
| | | if (scene == null) |
| | | { |
| | | continue; |
| | | } |
| | | sceneIDList.Add(scene.ScenesId); |
| | | } |
| | | foreach (var r in Lists) |
| | | { |
| | | if(r.IsLove) |
| | | { |
| | | continue; |
| | | } |
| | | if (r.SceneUIList == null || r.SceneUIList.Count == 0) |
| | | { |
| | | continue; |
| | | } |
| | | foreach (var rScene in r.SceneUIList) |
| | | { |
| | | if (rScene == null) |
| | | { |
| | | continue; |
| | | } |
| | | if (sceneIDList.Contains(rScene.Id) == false) |
| | | { |
| | | r.RemoveScene(rScene); |
| | | result = true; |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | #endregion |