From aed247d7fa4499665041864479fae82089eafe5f Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期二, 07 一月 2020 09:15:57 +0800 Subject: [PATCH] 2019.1.7 --- ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 105 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 95 insertions(+), 10 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index a5d22e8..82e94d9 100644 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -919,6 +919,7 @@ /// </summary> private void ShowFunction() { + functionSceneBodyView.RemoveAll(); //閫夋嫨鍔熻兘--鐩存帴浠庢埧闂寸殑devicelist涓幏鍙� var deviceList = Room.CurrentRoom.DeviceUIList; if (deviceList == null) @@ -1018,7 +1019,6 @@ lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); lightView.SetStatuText(device.GetDeviceStatu()); lightView.SetDeviceName(rollerShade.DeviceEpointName); - //lightView.SetStatu(true); lightView.IsSelected = rollerShade.WcdCurrentPositionLiftPercentage == 100; lightView.SetCollect(true); @@ -1086,8 +1086,20 @@ UserView.HomePage.Instance.AddChidren(rollerShadeControl); UserView.HomePage.Instance.PageIndex += 1; UserView.HomePage.Instance.ScrollEnabled = false; - //rollerShadeControl.action = RefreshBodyView; rollerShadeControl.Show(device, Room.CurrentRoom); + rollerShadeControl.action += (curDev, curRoom) => + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Common.Room.CurrentRoom.DeleteDevice(device.FileName); + ShowFunction(); + } + else + { + lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); + lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); + } + }; }; lightView.CollectButton.MouseUpEventHandler += collectionEvent; @@ -1204,24 +1216,60 @@ var lightControl = new Phone.Device.Light.OnOffControl(); UserView.HomePage.Instance.AddChidren(lightControl); UserView.HomePage.Instance.PageIndex += 1; - //lightControl.action = RefreshBodyView; lightControl.Show(device, Room.CurrentRoom); + lightControl.action += (curDev, curRoom) => + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Common.Room.CurrentRoom.DeleteDevice(device.FileName); + ShowFunction(); + } + else + { + lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); + lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); + } + }; } else if (device.CommonDevice.DfunctionType == DeviceFunctionType.A鎻掑骇) { var lightControl = new Phone.Device.Light.PlugControl(); UserView.HomePage.Instance.AddChidren(lightControl); UserView.HomePage.Instance.PageIndex += 1; - //lightControl.action = RefreshBodyView; lightControl.Show(device, Room.CurrentRoom); + lightControl.action += (curDev, curRoom) => + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Common.Room.CurrentRoom.DeleteDevice(device.FileName); + ShowFunction(); + } + else + { + lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); + lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); + } + }; } else { var lightControl = new Phone.Device.Light.LightControl(); UserView.HomePage.Instance.AddChidren(lightControl); UserView.HomePage.Instance.PageIndex += 1; - //lightControl.action = RefreshBodyView; lightControl.Show(device, Room.CurrentRoom); + lightControl.action += (curDev, curRoom) => + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Common.Room.CurrentRoom.DeleteDevice(device.FileName); + ShowFunction(); + } + else + { + lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); + lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); + } + }; } }; @@ -1261,7 +1309,6 @@ lightView.SetDeviceImage(device.IconPath, device.OnlineIconPath); lightView.SetStatuText(device.GetDeviceStatu()); lightView.SetDeviceName(airSwitch.DeviceEpointName); - //lightView.SetStatu(true); lightView.IsSelected = airSwitch.OnOffStatus == 1; lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); @@ -1328,8 +1375,21 @@ var lightControl = new Phone.Device.Light.AirSwitchControl(); UserView.HomePage.Instance.AddChidren(lightControl); UserView.HomePage.Instance.PageIndex += 1; - //lightControl.action = RefreshBodyView; lightControl.Show(device, Room.CurrentRoom); + lightControl.action += (curDev, curRoom) => + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Common.Room.CurrentRoom.DeleteDevice(device.FileName); + ShowFunction(); + } + else + { + lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); + lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); + } + }; + }; lightView.CollectButton.MouseUpEventHandler += collectionEvent; @@ -1434,8 +1494,20 @@ var lightControl = new Phone.Device.AC.ACControl(); UserView.HomePage.Instance.AddChidren(lightControl); UserView.HomePage.Instance.PageIndex += 1; - //lightControl.action = RefreshBodyView; lightControl.Show(device, Room.CurrentRoom); + lightControl.action += (curDev, curRoom) => + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Common.Room.CurrentRoom.DeleteDevice(device.FileName); + ShowFunction(); + } + else + { + lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); + lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); + } + }; }; lightView.CollectButton.MouseUpEventHandler += collectionEvent; @@ -1552,8 +1624,20 @@ var dimmableLightControl = new Phone.Device.Light.DimmableLightControl(); UserView.HomePage.Instance.AddChidren(dimmableLightControl); UserView.HomePage.Instance.PageIndex += 1; - //dimmableLightControl.action = RefreshBodyView; dimmableLightControl.Show(device, Room.CurrentRoom); + dimmableLightControl.action += (curDev, curRoom) => + { + if (curRoom.Id != Common.Room.CurrentRoom.Id) + { + Common.Room.CurrentRoom.DeleteDevice(device.FileName); + ShowFunction(); + } + else + { + lightView.SetDeviceImage(curDev.IconPath, curDev.OnlineIconPath); + lightView.SetDeviceName(curDev.CommonDevice.DeviceEpointName); + } + }; }; lightView.CollectButton.MouseUpEventHandler += collectionEvent; } @@ -1691,7 +1775,7 @@ lightView.SetStatuText(device.GetDeviceStatu()); lightView.SetDeviceName(device.CommonDevice.DeviceEpointName); lightView.CanControl(false); - lightView.IsSelected = device.CommonDevice.IsOnline == 1; + //lightView.IsSelected = device.CommonDevice.IsOnline == 1; lightView.SetCollect(Room.CurrentRoom.IsCollectInRoom(Room.CurrentRoom, device.FileName)); var dev = Room.LoveRoomDeviceUIFilePathList.Find((obj) => obj == device.FileName); @@ -1752,6 +1836,7 @@ /// </summary> private void ShowScene() { + functionSceneBodyView.RemoveAll(); //閫夋嫨鍦烘櫙 var sceneList = Room.CurrentRoom.SceneUIList; if (sceneList == null) -- Gitblit v1.8.0