From 1a2061079e97a738ec7b8959bfd9a6e6c6997403 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 31 十月 2019 09:59:29 +0800
Subject: [PATCH] 2019.10.31

---
 ZigbeeApp/Shared/Phone/Device/Category/Category.cs |  199 +++++++++++++++++++++++++------------------------
 1 files changed, 100 insertions(+), 99 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
old mode 100755
new mode 100644
index 3aed5d9..4405a9a
--- a/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Category/Category.cs
@@ -162,10 +162,10 @@
                             {
                                 case DeviceType.OnOffOutput:
                                     //寮�鍏冲姛鑳�
-                                    if (common.DeviceStatusReport.CluterID == 6)
+                                    if ((common as ToggleLight).DeviceStatusReport.CluterID == 6)
                                     {
                                         var light = deviceUI.CommonDevice as ToggleLight;
-                                        light.DeviceStatusReport = common.DeviceStatusReport;
+                                        light.DeviceStatusReport = (common as ToggleLight).DeviceStatusReport;
                                         for (int j = 0; j < rowLayout.ChildrenCount; j++)
                                         {
                                             var tempView = rowLayout.GetChildren(j);
@@ -187,7 +187,7 @@
                                             }
                                         }
                                     }
-                                    if (common.DeviceStatusReport.CluterID == 3)
+                                    if ((common as ToggleLight).DeviceStatusReport.CluterID == 3)
                                     {
                                         var light = deviceUI.CommonDevice as ToggleLight;
                                         light.IsOnline = 1;
@@ -210,10 +210,10 @@
 
                                 case DeviceType.AirSwitch:
                                     //寮�鍏冲姛鑳�
-                                    if (common.DeviceStatusReport.CluterID == 6)
+                                    if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 6)
                                     {
                                         var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
-                                        airSwitch.DeviceStatusReport = common.DeviceStatusReport;
+                                        airSwitch.DeviceStatusReport = (common as ZigBee.Device.AirSwitch).DeviceStatusReport;
                                         for (int j = 0; j < rowLayout.ChildrenCount; j++)
                                         {
                                             var tempView = rowLayout.GetChildren(j);
@@ -235,7 +235,7 @@
                                             }
                                         }
                                     }
-                                    if (common.DeviceStatusReport.CluterID == 3)
+                                    if ((common as ZigBee.Device.AirSwitch).DeviceStatusReport.CluterID == 3)
                                     {
                                         var airSwitch = deviceUI.CommonDevice as ZigBee.Device.AirSwitch;
                                         airSwitch.IsOnline = 1;
@@ -256,7 +256,7 @@
                                     }
                                     break;
                                 case DeviceType.WindowCoveringDevice:
-                                    if (common.DeviceStatusReport.CluterID == 3)
+                                    if ((common as Rollershade).DeviceStatusReport.CluterID == 3)
                                     {
                                         var rollerShape = deviceUI.CommonDevice as Rollershade;
                                         //璁板綍鍥炲鏃堕棿
@@ -279,15 +279,15 @@
 
                                 case DeviceType.Thermostat:
                                     //AC鍔熻兘
-                                    if (common.DeviceStatusReport.CluterID == 513)
+                                    if ((common as ZigBee.Device.AC).DeviceStatusReport.CluterID == 513)
                                     {
-                                        var attriButeList = common.DeviceStatusReport.AttriBute;
+                                        var attriButeList = (common as ZigBee.Device.AC).DeviceStatusReport.AttriBute;
                                         if (attriButeList == null || attriButeList.Count == 0)
                                         {
                                             return;
                                         }
                                         var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
-                                        ac.DeviceStatusReport = common.DeviceStatusReport;
+                                        ac.DeviceStatusReport = (common as ZigBee.Device.AC).DeviceStatusReport;
                                         switch (attriButeList[0].AttributeId)
                                         {
                                             case 0:
@@ -336,7 +336,7 @@
                                         }
 
                                     }
-                                    if (common.DeviceStatusReport.CluterID == 3)
+                                    if ((common as ZigBee.Device.AC).DeviceStatusReport.CluterID == 3)
                                     {
                                         var ac = deviceUI.CommonDevice as ZigBee.Device.AC;
                                         ac.IsOnline = 1;
@@ -358,10 +358,10 @@
                                     break;
                                 case DeviceType.DimmableLight:
                                     //璋冨厜鐏姛鑳�
-                                    if (common.DeviceStatusReport.CluterID == 6)
+                                    if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 6)
                                     {
                                         var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
-                                        dimmableLight.DeviceStatusReport = common.DeviceStatusReport;
+                                        dimmableLight.DeviceStatusReport = (common as ZigBee.Device.DimmableLight).DeviceStatusReport;
                                         for (int j = 0; j < rowLayout.ChildrenCount; j++)
                                         {
                                             var tempView = rowLayout.GetChildren(j);
@@ -383,7 +383,7 @@
                                             }
                                         }
                                     }
-                                    if (common.DeviceStatusReport.CluterID == 3)
+                                    if ((common as ZigBee.Device.DimmableLight).DeviceStatusReport.CluterID == 3)
                                     {
                                         var dimmableLight = deviceUI.CommonDevice as ZigBee.Device.DimmableLight;
                                         dimmableLight.IsOnline = 1;
@@ -543,7 +543,7 @@
         /// <param name="selectedBtn">閫変腑閭d釜鐣岄潰 0--鍔熻兘 1--鍦烘櫙 2--鑷姩鍖� </param>
         public void Show(int selectedBtn = 1)
         {
-            
+
             ZbGateway.StatusList.Add(this);
             RemoveAll();
 
@@ -1037,7 +1037,7 @@
                                 lightControl.action = RefreshBodyView;
                                 lightControl.Show(deviceUI, room);
                             };
-                            
+
                             var editBtn = new CommonForm.RowLayoutEditButton()
                             {
                                 Tag = deviceUI,
@@ -1102,8 +1102,8 @@
                                 zbGateway.ReportAction += UpdateDeviceControllStatu;
                                 AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
 
-                                (send2 as CommonForm.SelectedStatuButton).IsSelected = !(send2 as CommonForm.SelectedStatuButton).IsSelected;
-                                if ((send2 as CommonForm.SelectedStatuButton).IsSelected)
+                                (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
+                                if ((send2 as Button).IsSelected)
                                 {
                                     airSwitch.SwitchControl(1);
                                 }
@@ -1201,8 +1201,8 @@
                                 zbGateway.ReportAction += UpdateDeviceControllStatu;
                                 AddZbGateway(zbGatewayList, zbGateway, commonDeviceList, deviceUI.CommonDevice);
 
-                                (send2 as CommonForm.SelectedStatuButton).IsSelected = !(send2 as CommonForm.SelectedStatuButton).IsSelected;
-                                if ((send2 as CommonForm.SelectedStatuButton).IsSelected)
+                                (send2 as Button).IsSelected = !(send2 as Button).IsSelected;
+                                if ((send2 as Button).IsSelected)
                                 {
                                     dimmableLight.SwitchControl(1);
                                 }
@@ -1463,7 +1463,7 @@
                     typeRowLayout.AddChidren(functionTypeIMG);
 
                     functionTypeIMG.ClickBtn.MouseUpEventHandler += ShowSameTypeFunction;
-                   
+
 
                     if (deviceType == room.DeviceUIList[0].CommonDevice.Type)
                     {
@@ -1534,7 +1534,7 @@
                     {
                         RefreshFunction(room);
                     }
-                   
+
                 }
                 roomBtn.MouseUpEventHandler += (sender, e) =>
                 {
@@ -1555,7 +1555,7 @@
                     }
                 };
             }
-            
+
         }
 
         #endregion
@@ -1640,7 +1640,7 @@
                         Tag = scene
                     };
                     leftFL.AddChidren(collectionBtn);
-                    
+
                     var sceneNameBtn = new Button()
                     {
                         Width = Application.GetRealWidth(176),
@@ -1789,7 +1789,7 @@
                                 }
                             };
                         }
-                        
+
                     };
                     deleteBtn.MouseUpEventHandler += delEvent;
                     //缂栬緫鍦烘櫙
@@ -1845,6 +1845,7 @@
 
         #endregion
 
+
         #region 鈼� 鑷姩鍖朹_________________________
 
         /// <summary>
@@ -1854,7 +1855,7 @@
         {
 
             functionSceneAutoBodyView.BackgroundColor = ZigbeeColor.Current.LogicMiddleBackgroundColor;
-            
+
             var bjFrameLayout = new FrameLayout
             {
                 Width = Application.GetRealWidth(1080 - 58),
@@ -2021,7 +2022,7 @@
                 var Idlist = await Logic.Send.GetLogicId(0);
                 if (Idlist.Count != 0)
                 {
-                    var listlogic = await Logic.Send.ReadList(Idlist.Count,0);
+                    var listlogic = await Logic.Send.ReadList(Idlist.Count, 0);
                     //foreach鍙兘闆嗗悎宸茶淇敼,鏋氫妇鎿嶄綔鍙兘涓嶄細鎵ц,鍙兘鍑虹幇宕╂簝(寤鸿for)銆�
                     for (int j = 0; j < listlogic.Count; j++)
                     {
@@ -2174,78 +2175,6 @@
 
 
         }
-
-        #region 鈼� 鎺у埗鐘舵�乢________________________
-
-        /// <summary>
-        /// 鏄剧ず璁惧鎺у埗鐘舵��
-        /// </summary>
-        /// <param name="command">Command.</param>
-        /// <param name="objValue">Object value.</param>
-        private void UpdateDeviceControllStatu(string command, object objValue)
-        {
-            if (command != "DeviceDefaultAck" || objValue == null)
-            {
-                return;
-            }
-            var tempDevice = (CommonDevice)objValue;
-            if (null == commonDeviceList.Find((obj) => obj.DeviceEpoint == tempDevice.DeviceEpoint && obj.DeviceAddr == tempDevice.DeviceAddr))
-            {
-                return;
-            }
-            //鏍囪宸茬粡鍙戦�佹帶鍒跺懡浠ゅ埌缃戝叧
-            sendedControlCommand = true;
-            //DeviceUI.ShowStatuTip(R.MyInternationalizationString.Success);
-        }
-
-        /// <summary>
-        /// 绉婚櫎鍏ㄩ儴鏇存柊鎺у埗璁惧鐨刟ction
-        /// </summary>
-        private void RemoveAllUpdateControlDeviceStatuAction()
-        {
-            foreach (var gateway in zbGatewayList)
-            {
-                //绉婚櫎action
-                if (gateway != null)
-                {
-                    gateway.ReportAction -= UpdateDeviceControllStatu;
-                }
-            }
-        }
-
-        /// <summary>
-        /// 绉婚櫎鍗曚釜鎺у埗璁惧鐨勬洿鏂扮姸鎬乤ction
-        /// </summary>
-        /// <param name="gateway">Gateway.</param>
-        private void RemoveUpdateControlDeviceStatuAction(ZbGateway gateway)
-        {
-            //绉婚櫎action
-            if (gateway != null)
-            {
-                gateway.ReportAction -= UpdateDeviceControllStatu;
-            }
-        }
-
-        /// <summary>
-        /// 娣诲姞闇�瑕佺洃鎺у洖璋冪姸鎬佺殑缃戝叧鍜岃澶�
-        /// </summary>
-        /// <param name="gatewayList">Gateway list.</param>
-        /// <param name="gateway">Gateway.</param>
-        /// <param name="deviceList">Device list.</param>
-        /// <param name="common">Common.</param>
-        private void AddZbGateway(List<ZbGateway> gatewayList, ZbGateway gateway, List<CommonDevice> deviceList, CommonDevice common)
-        {
-            if (null == gatewayList.Find((obj) => obj.getGatewayBaseInfo.gwID == gateway.getGatewayBaseInfo.gwID))
-            {
-                gatewayList.Add(gateway);
-            }
-            if (null == commonDeviceList.Find((obj) => obj.DeviceEpoint == common.DeviceEpoint && obj.DeviceAddr == common.DeviceAddr))
-            {
-                commonDeviceList.Add(common);
-            }
-        }
-
-        #endregion
 
         private void StatusColor(Common.Logic logic, RowLayout logicRowlayout, int intvalue)
         {
@@ -2641,5 +2570,77 @@
             }
         }
         #endregion
+
+        #region 鈼� 鎺у埗鐘舵�乢________________________
+
+        /// <summary>
+        /// 鏄剧ず璁惧鎺у埗鐘舵��
+        /// </summary>
+        /// <param name="command">Command.</param>
+        /// <param name="objValue">Object value.</param>
+        private void UpdateDeviceControllStatu(string command, object objValue)
+        {
+            if (command != "DeviceDefaultAck" || objValue == null)
+            {
+                return;
+            }
+            var tempDevice = (CommonDevice)objValue;
+            if (null == commonDeviceList.Find((obj) => obj.DeviceEpoint == tempDevice.DeviceEpoint && obj.DeviceAddr == tempDevice.DeviceAddr))
+            {
+                return;
+            }
+            //鏍囪宸茬粡鍙戦�佹帶鍒跺懡浠ゅ埌缃戝叧
+            sendedControlCommand = true;
+            //DeviceUI.ShowStatuTip(R.MyInternationalizationString.Success);
+        }
+
+        /// <summary>
+        /// 绉婚櫎鍏ㄩ儴鏇存柊鎺у埗璁惧鐨刟ction
+        /// </summary>
+        private void RemoveAllUpdateControlDeviceStatuAction()
+        {
+            foreach (var gateway in zbGatewayList)
+            {
+                //绉婚櫎action
+                if (gateway != null)
+                {
+                    gateway.ReportAction -= UpdateDeviceControllStatu;
+                }
+            }
+        }
+
+        /// <summary>
+        /// 绉婚櫎鍗曚釜鎺у埗璁惧鐨勬洿鏂扮姸鎬乤ction
+        /// </summary>
+        /// <param name="gateway">Gateway.</param>
+        private void RemoveUpdateControlDeviceStatuAction(ZbGateway gateway)
+        {
+            //绉婚櫎action
+            if (gateway != null)
+            {
+                gateway.ReportAction -= UpdateDeviceControllStatu;
+            }
+        }
+
+        /// <summary>
+        /// 娣诲姞闇�瑕佺洃鎺у洖璋冪姸鎬佺殑缃戝叧鍜岃澶�
+        /// </summary>
+        /// <param name="gatewayList">Gateway list.</param>
+        /// <param name="gateway">Gateway.</param>
+        /// <param name="deviceList">Device list.</param>
+        /// <param name="common">Common.</param>
+        private void AddZbGateway(List<ZbGateway> gatewayList, ZbGateway gateway, List<CommonDevice> deviceList, CommonDevice common)
+        {
+            if (null == gatewayList.Find((obj) => obj.getGatewayBaseInfo.gwID == gateway.getGatewayBaseInfo.gwID))
+            {
+                gatewayList.Add(gateway);
+            }
+            if (null == commonDeviceList.Find((obj) => obj.DeviceEpoint == common.DeviceEpoint && obj.DeviceAddr == common.DeviceAddr))
+            {
+                commonDeviceList.Add(common);
+            }
+        }
+
+        #endregion
     }
 }

--
Gitblit v1.8.0