From 5204bc34549ba4718158c447cbb3c74b39ffe163 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期一, 02 十二月 2019 16:03:29 +0800
Subject: [PATCH] 2019.12.2

---
 ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs |  184 +++++++++++++++++++++++++++++----------------
 1 files changed, 117 insertions(+), 67 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs b/ZigbeeApp/Shared/Phone/UserView/UserHomeView.cs
index ac477b1..6747f9f 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;
@@ -621,16 +631,18 @@
 
             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),
                 };
                 AddChidren(roomPageView);
+                //涓庡睆骞曡竟妗嗙殑杈硅窛
+                roomPageView.RowPadding = Application.GetRealWidth(181);
+                //涓や釜page涔嬮棿鐨勯棿璺�
+                roomPageView.PagePadding = Application.GetRealWidth(69);
 
                 //褰撳墠鎴块棿
                 //Room.CurrentRoom = Room.CurrentRoom == null ? Room.Lists[0] : Room.CurrentRoom;
@@ -640,39 +652,104 @@
                 {
                     var roomBackView = new FrameLayout()
                     {
-                        BackgroundImagePath = room.BackgroundImage
+                        Width = Application.GetRealWidth(717),
+                        Height=Application.GetRealHeight(478)
                     };
                     roomPageView.AddChidren(roomBackView);
-                    var roomBG = new Button()
+
+                    var roomImg = new ImageView()
                     {
-                        UnSelectedImagePath = "Room/HomeBG.png",
-                        //UnSelectedImagePath = room.BackgroundImage
+                        ImagePath = room.BackgroundImageType == 0 ? room.BackgroundImage : System.IO.Path.Combine(Config.Instance.FullPath, room.BackgroundImage),
+                        Radius = (uint)Application.GetRealHeight(17)
                     };
-                    roomBackView.AddChidren(roomBG);
+                    roomBackView.AddChidren(roomImg);
+
+                    var roomNameBackground = new FrameLayout
+                    {
+                        X = Application.GetRealWidth(29),
+                        Y = Application.GetRealHeight(282),
+                        Width = Application.GetRealWidth(200),
+                        Height = Application.GetRealHeight(80),
+                        BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor2
+                    };
+                    roomBackView.AddChidren(roomNameBackground);
+                    roomNameBackground.SetCornerWithSameRadius(Application.GetRealHeight(40), HDLUtils.RectCornerTopRight | HDLUtils.RectCornerBottomRight);
+
                     var roomName = new Button()
                     {
-                        X = Application.GetRealWidth(20),
-                        Y = Application.GetRealHeight(20),
-                        Width = Application.GetRealWidth(500),
-                        Height = Application.GetRealHeight(80),
+                        X = Application.GetRealWidth(5),
+                        Width = Application.GetRealWidth(190),
                         Text = room.Name,
-                        TextAlignment = TextAlignment.CenterLeft,
                         TextColor = ZigbeeColor.Current.GXCTextWhiteColor,
-                        TextSize = 18,
                     };
-                    roomBackView.AddChidren(roomName);
-                    var roomListBtn = new Device.CommonForm.SelectedStatuButton()
+                    roomNameBackground.AddChidren(roomName);
+
+
+                    var roomTemperatureBackground = new FrameLayout
                     {
-                        X = roomPageView.Width - Application.GetRealWidth(100 + 20),
+                        X = Application.GetRealWidth(29),
+                        Y = Application.GetRealHeight(374),
+                        Width = Application.GetRealWidth(340),
+                        Height = Application.GetRealHeight(80),
+                        BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor2
+                    };
+                    roomBackView.AddChidren(roomTemperatureBackground);
+                    roomTemperatureBackground.SetCornerWithSameRadius(Application.GetRealHeight(40), HDLUtils.RectCornerTopRight | HDLUtils.RectCornerBottomRight);
+
+                    var temperatureIcon = new Button
+                    {
+                        X = Application.GetRealWidth(12),
+                        Width = Application.GetMinRealAverage(58),
+                        Height = Application.GetMinRealAverage(58),
+                        Gravity = Gravity.CenterVertical,
+                        UnSelectedImagePath = "Room/Temperature.png"
+                    };
+                    roomTemperatureBackground.AddChidren(temperatureIcon);
+
+                    var temperatureText = new Button
+                    {
+                        X = Application.GetRealWidth(69),
+                        Width = Application.GetRealWidth(86),
+                        Height = Application.GetRealHeight(58),
+                        Gravity = Gravity.CenterVertical,
+                        Text="26鈩�"
+                    };
+                    roomTemperatureBackground.AddChidren(temperatureText);
+
+                    var humidityIcon = new Button
+                    {
+                        X = Application.GetRealWidth(179),
+                        Width = Application.GetMinRealAverage(58),
+                        Height = Application.GetMinRealAverage(58),
+                        Gravity = Gravity.CenterVertical,
+                        UnSelectedImagePath = "Room/Humidity.png"
+                    };
+                    roomTemperatureBackground.AddChidren(humidityIcon);
+
+                    var humidityText = new Button
+                    {
+                        X = Application.GetRealWidth(236),
+                        Width = Application.GetRealWidth(86),
+                        Height = Application.GetRealHeight(58),
+                        Gravity = Gravity.CenterVertical,
+                        Text = "13%"
+                    };
+                    roomTemperatureBackground.AddChidren(humidityText);
+
+
+                    var roomListBtn = new Button()
+                    {
+                        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;
@@ -792,9 +869,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();
             };
         }
@@ -1008,14 +1086,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);
@@ -1087,6 +1165,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;
@@ -1112,16 +1191,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);
                             }
                         }
 
@@ -1203,6 +1280,7 @@
 
                         lightView.CardBG.MouseUpEventHandler += (sender, e) =>
                         {
+                            CommonPage.Instance.IsDrawerLockMode = true;
                             if (device.CommonDevice.DfunctionType == DeviceFunctionType.A寮�鍏�)
                             {
                                 var lightControl = new Phone.Device.Light.OnOffControl();
@@ -1246,8 +1324,7 @@
                             //鍙戦�佽鍙栫姸鎬佸懡浠�
                             ReadStatus(airSwitch, () =>
                             {
-                                airSwitch.ReadOnOffStatus();
-                                airSwitch.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
+                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice);
                             });
                         }
                         else
@@ -1255,8 +1332,7 @@
                             //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵��
                             if ((DateTime.Now - airSwitch.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                             {
-                                airSwitch.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
-                                airSwitch.ReadOnOffStatus();
+                                ReadDeviceAttributeLogic.Instance.SendLightStatuComand(device.CommonDevice);
                             }
                         }
 
@@ -1329,6 +1405,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;
@@ -1353,14 +1430,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
@@ -1368,14 +1438,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);
@@ -1446,6 +1509,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;
@@ -1469,8 +1533,7 @@
                             //鍙戦�佽鍙栫姸鎬佸懡浠�
                             ReadStatus(dimmableLight, () =>
                             {
-                                dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
-                                dimmableLight.ReadOnOffStatus();
+                                ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice);
                             });
                         }
                         else
@@ -1478,8 +1541,7 @@
                             //闃叉鐭椂闂村唴澶氭璇诲彇璁惧鐘舵��
                             if ((DateTime.Now - dimmableLight.LastDateTime).TotalSeconds > CommonPage.ReadDeviceStatuSpan)
                             {
-                                dimmableLight.ReadAttri(Cluster_ID.Identify, AttriButeId.Switch);
-                                dimmableLight.ReadOnOffStatus();
+                                ReadDeviceAttributeLogic.Instance.SendDimmableLightStatuComand(device.CommonDevice);
                             }
                         }
 
@@ -1561,6 +1623,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;
@@ -1578,20 +1641,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);
@@ -1615,6 +1664,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