From ac334861efbf06933e95c62ced0484410f34bece Mon Sep 17 00:00:00 2001 From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local> Date: 星期五, 29 十一月 2019 18:00:32 +0800 Subject: [PATCH] 2019.11.29 --- ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs | 106 +++++++++++++++++++++------------------------------- 1 files changed, 43 insertions(+), 63 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs index 017e272..050c746 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 { @@ -630,16 +631,20 @@ if (CanBindGateway() == false) { - var roomPageView = new PageLayout() + + var roomPageView = new HorizontalPages() { Y = Application.GetRealHeight(302), - Width = Application.GetRealWidth(CommonPage.AppRealWidth - CommonPage.XLeft * 2), - Height = Application.GetMinRealAverage(roomPageView_Height), - Radius = CommonPage.BigFormRadius, - Gravity = Gravity.CenterHorizontal, - IsShowPoint = false + Width = Application.GetRealWidth(CommonPage.AppRealWidth), + Height = Application.GetRealHeight(478), + //Radius = CommonPage.BigFormRadius, + //Gravity = Gravity.CenterHorizontal, }; AddChidren(roomPageView); + //涓庡睆骞曡竟妗嗙殑杈硅窛 + roomPageView.RowPadding = Application.GetRealWidth(181); + //涓や釜page涔嬮棿鐨勯棿璺� + roomPageView.PagePadding = Application.GetRealWidth(69); //褰撳墠鎴块棿 //Room.CurrentRoom = Room.CurrentRoom == null ? Room.Lists[0] : Room.CurrentRoom; @@ -649,15 +654,18 @@ { var roomBackView = new FrameLayout() { - BackgroundImagePath = room.BackgroundImage + BackgroundImagePath = room.BackgroundImage, + Width = Application.GetRealWidth(717), + Height=Application.GetRealHeight(478), + Radius=(uint)Application.GetRealHeight(10) }; 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), @@ -670,18 +678,19 @@ TextSize = 18, }; roomBackView.AddChidren(roomName); - var roomListBtn = new Device.CommonForm.SelectedStatuButton() + var roomListBtn = new Button() { - X = roomPageView.Width - Application.GetRealWidth(100 + 20), + X = roomBackView.Width - Application.GetRealWidth(100 + 20), Y = Application.GetRealHeight(20), Width = Application.GetMinRealAverage(100), Height = Application.GetMinRealAverage(100), - UnSelectedImagePath = "Item/List.png", + UnSelectedImagePath = "Room/List.png", }; roomBackView.AddChidren(roomListBtn); roomListBtn.MouseUpEventHandler += (send, e) => { + CommonPage.Instance.IsDrawerLockMode = true; var editRoom = new Device.Room.EditRoom(); HomePage.Instance.AddChidren(editRoom); HomePage.Instance.PageIndex += 1; @@ -801,9 +810,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(); }; } @@ -1017,14 +1027,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); @@ -1096,6 +1106,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; @@ -1121,16 +1132,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); } } @@ -1212,6 +1221,7 @@ lightView.CardBG.MouseUpEventHandler += (sender, e) => { + CommonPage.Instance.IsDrawerLockMode = true; if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�) { var lightControl = new Phone.Device.Light.OnOffControl(); @@ -1255,8 +1265,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� ReadStatus(airSwitch, () => { - airSwitch.ReadOnOffStatus(); - airSwitch.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); + ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice); }); } else @@ -1264,8 +1273,7 @@ //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵�� if ((DateTime.Now - airSwitch.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - airSwitch.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - airSwitch.ReadOnOffStatus(); + ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice); } } @@ -1338,6 +1346,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; @@ -1362,15 +1371,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� ReadStatus(ac, () => { - ac.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - ac.ReadLocalTemperature(); - ac.ReadCoolingSetpoint(); - ac.ReadHeatingSetpoint(); - ac.ReadAutoSetpoint(); - ac.ReadFanMode(); - ac.ReadSystemMode(); - ac.ReadSystemFansSwingMode(); - ac.ReadModeSupport(); + ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice); }); } else @@ -1378,15 +1379,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(); - ac.ReadModeSupport(); + ReadDeviceAttributeLogic.Instance.SendACStatuComand(device.CommonDevice); } } var lightView = new FunctionMainView(xx, yy); @@ -1457,6 +1450,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; @@ -1480,8 +1474,7 @@ //鍙戦�佽鍙栫姸鎬佸懡浠� ReadStatus(dimmableLight, () => { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - dimmableLight.ReadOnOffStatus(); + ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); }); } else @@ -1489,8 +1482,7 @@ //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵�� if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan) { - dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch); - dimmableLight.ReadOnOffStatus(); + ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice); } } @@ -1572,6 +1564,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; @@ -1589,20 +1582,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); @@ -1626,6 +1605,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