From b94f318b1cb5c3618dd53b5240c1d999c8427b71 Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 29 十一月 2019 13:09:25 +0800 Subject: [PATCH] 2019.11.29 --- ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 90 +++++++++++++++++--------------------------- 1 files changed, 35 insertions(+), 55 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index b20b6e1..03ff3a0 100644 --- a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs +++ b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs @@ -6,6 +6,7 @@ using Shared.Phone.Device.CommonForm; using Shared.Phone.UserCenter.DoorLock; using System.Timers; +using Shared.Phone.Device.DeviceLogic; namespace Shared.Phone.UserView { @@ -259,6 +260,15 @@ //姝ゅ睘鎬ф弿杩版亽娓╄澶囨澶勪簬鍝妯″紡 ac.currentSystemMode = attriButeList[0].AttriButeData; ac.LastDateTime = DateTime.Now; + break; + + case 4099: + var value = Convert.ToString(attriButeList[0].AttriButeData, 2).PadLeft(16, '0'); + var modeStr = value.Substring(value.Length - 5, 5); + for (int j = 0; j < modeStr.Length; j++) + { + ac.listSupportMode[j] = Convert.ToInt32(modeStr[j]) == 49 ? 1 : 0; + } break; } (rowFL.GetChildren(0) as FunctionMainView).IsSelected = ac.currentSystemMode != 0; @@ -614,10 +624,7 @@ //娑堟伅 messageBtn.MouseUpEventHandler += (send, e) => { - var roomList = new Shared.Phone.Device.Room.RoomManagement(); - HomePage.Instance.AddChidren(roomList); - HomePage.Instance.PageIndex += 1; - roomList.Show(); + }; #endregion @@ -646,12 +653,11 @@ BackgroundImagePath = room.BackgroundImage }; roomPageView.AddChidren(roomBackView); - var roomBG = new Button() + if (room.BackgroundImageType != 0) { - UnSelectedImagePath = "Room/HomeBG.png", - //UnSelectedImagePath = room.BackgroundImage - }; - roomBackView.AddChidren(roomBG); + roomBackView.BackgroundImagePath = System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage); + } + var roomName = new Button() { X = Application.GetRealWidth(20), @@ -676,6 +682,7 @@ roomListBtn.MouseUpEventHandler += (send, e) => { + CommonPage.Instance.IsDrawerLockMode = true; var editRoom = new Device.Room.EditRoom(); HomePage.Instance.AddChidren(editRoom); HomePage.Instance.PageIndex += 1; @@ -795,9 +802,10 @@ var floorFL = new Phone.Device.Category.SelectFloor(); AddChidren(floorFL); floorFL.Init(35, 153); - floorFL.FloorAction = (floorName) => + floorFL.changeFloor = true; + floorFL.FloorAction = (floorId) => { - floorBtn.Text = floorName; + floorBtn.Text = Config.Instance.Home.GetFloorNameById(floorId); Show(); }; } @@ -1011,14 +1019,14 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� ReadStatus(rollerShade, () => { - rollerShade.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice); }); } else { if (CommonPage.ReadDeviceStatuSpan < (DateTime.Now - rollerShade.LastDateTime).TotalSeconds) { - rollerShade.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + ReadDeviceAttributeLogic.Instance.SendCurtainStatuComand(device.CommonDevice); } } var lightView = new FunctionMainView(xx, yy); @@ -1090,6 +1098,7 @@ lightView.CardBG.MouseUpEventHandler += (sender, e) => { + CommonPage.Instance.IsDrawerLockMode = true; var rollerShadeControl = new Phone.Device.Curtain.RollerShadeControl(); UserView.HomePage.Instance.AddChidren(rollerShadeControl); UserView.HomePage.Instance.PageIndex += 1; @@ -1115,16 +1124,14 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� ReadStatus(light, () => { - light.ReadOnOffStatus(); - light.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice); }); } else { if (CommonPage.ReadDeviceStatuSpan < (DateTime.Now - light.LastDateTime).TotalSeconds) { - light.ReadOnOffStatus(); - light.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice); } } @@ -1206,6 +1213,7 @@ lightView.CardBG.MouseUpEventHandler += (sender, e) => { + CommonPage.Instance.IsDrawerLockMode = true; if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�) { var lightControl = new Phone.Device.Light.OnOffControl(); @@ -1249,8 +1257,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� ReadStatus(airSwitch, () => { - airSwitch.ReadOnOffStatus(); - airSwitch.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice); }); } else @@ -1258,8 +1265,7 @@ //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵�� if ((DateTime.Now - airSwitch.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - airSwitch.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - airSwitch.ReadOnOffStatus(); + ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice); } } @@ -1332,6 +1338,7 @@ lightView.CardBG.MouseUpEventHandler += (sender, e) => { + CommonPage.Instance.IsDrawerLockMode = true; var lightControl = new Phone.Device.Light.AirSwitchControl(); UserView.HomePage.Instance.AddChidren(lightControl); UserView.HomePage.Instance.PageIndex += 1; @@ -1356,14 +1363,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� ReadStatus(ac, () => { - ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - ac.ReadLocalTemperature(); - ac.ReadCoolingSetpoint(); - ac.ReadHeatingSetpoint(); - ac.ReadAutoSetpoint(); - ac.ReadFanMode(); - ac.ReadSystemMode(); - ac.ReadSystemFansSwingMode(); + ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice); }); } else @@ -1371,14 +1371,7 @@ //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵�� if ((DateTime.Now - ac.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - ac.ReadLocalTemperature(); - ac.ReadCoolingSetpoint(); - ac.ReadHeatingSetpoint(); - ac.ReadAutoSetpoint(); - ac.ReadFanMode(); - ac.ReadSystemMode(); - ac.ReadSystemFansSwingMode(); + ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice); } } var lightView = new FunctionMainView(xx, yy); @@ -1449,6 +1442,7 @@ lightView.CardBG.MouseUpEventHandler += (sender, e) => { + CommonPage.Instance.IsDrawerLockMode = true; var lightControl = new Phone.Device.AC.ACControl(); UserView.HomePage.Instance.AddChidren(lightControl); UserView.HomePage.Instance.PageIndex += 1; @@ -1472,8 +1466,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� ReadStatus(dimmableLight, () => { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - dimmableLight.ReadOnOffStatus(); + ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); }); } else @@ -1481,8 +1474,7 @@ //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵�� if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - dimmableLight.ReadOnOffStatus(); + ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); } } @@ -1564,6 +1556,7 @@ lightView.CardBG.MouseUpEventHandler += (sender, e) => { + CommonPage.Instance.IsDrawerLockMode = true; var dimmableLightControl = new Phone.Device.Light.DimmableLightControl(); UserView.HomePage.Instance.AddChidren(dimmableLightControl); UserView.HomePage.Instance.PageIndex += 1; @@ -1581,20 +1574,6 @@ if (dimmableLight.Gateway == null) { continue; - } - if (dimmableLight.Gateway.IsVirtual) - { - ReadStatus(dimmableLight, () => - { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - }); - } - else - { - if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) - { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - } } var lightView = new FunctionMainView(xx, yy); @@ -1618,6 +1597,7 @@ lightView.CardBG.MouseUpEventHandler += (sender, e) => { + CommonPage.Instance.IsDrawerLockMode = true; var userDoorLockPage = new UserDoorLockPage(Room.CurrentRoom, device); HomePage.Instance.AddChidren(userDoorLockPage); HomePage.Instance.PageIndex += 1; -- Gitblit v1.8.0