From f1c3921b08bb22ac6f5db22d620e01d7e8e5c49f Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期一, 30 十二月 2019 13:32:33 +0800
Subject: [PATCH] 2019-12-30-1

---
 ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs |   50 ++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 36 insertions(+), 14 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
index 54e4f18..790e4e2 100755
--- a/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
@@ -62,6 +62,10 @@
 
         private Button StatuBtn;
 
+        /// <summary>
+        /// IsDrawerLockMode
+        /// </summary>
+        public bool IsDrawerLockMode;
         #endregion
 
         #region 鈼� 鎺ュ彛__________________________
@@ -121,10 +125,10 @@
                         }
                         if (deviceUI.CommonDevice.Type == DeviceType.OnOffOutput)
                         {
-                            if ((common as ToggleLight).DeviceStatusReport.CluterID == 6)
+                            if (common.DeviceStatusReport.CluterID == 6)
                             {
                                 var light = deviceUI.CommonDevice as ToggleLight;
-                                light.DeviceStatusReport = (common as ToggleLight).DeviceStatusReport;
+                                light.DeviceStatusReport = common.DeviceStatusReport;
                                 //璁板綍銆佹洿鏂扮姸鎬�
                                 if (light.DeviceStatusReport.AttriBute == null || light.DeviceStatusReport.AttriBute.Count == 0)
                                 {
@@ -145,7 +149,30 @@
             }
             else if (typeTag == "OnlineStatusChange")
             {
-
+                Application.RunOnMainThread(() =>
+                {
+                    try
+                    {
+                        var deviceUI = device;
+                        //璁惧涓虹┖
+                        if (deviceUI.CommonDevice == null)
+                        {
+                            return;
+                        }
+                        //鏄惁涓哄綋鍓嶈澶�
+                        if (deviceUI.CommonDevice.DeviceEpoint != common.DeviceEpoint || deviceUI.CommonDevice.DeviceAddr != common.DeviceAddr)
+                        {
+                            return;
+                        }
+                        deviceUI.CommonDevice.IsOnline = common.IsOnline;
+                        deviceIMG.IsSelected = switchBtn.IsSelected = deviceUI.CommonDevice.IsOnline == 1;
+                        deviceUI.CommonDevice.LastDateTime = DateTime.Now;
+                    }
+                    catch (Exception ex)
+                    {
+                        System.Console.WriteLine($"Error:{ex.Message}");
+                    }
+                });
             }
         }
         #endregion
@@ -157,8 +184,12 @@
         public override void RemoveFromParent()
         {
             ZbGateway.StatusList.Remove(this);
-            action();
-            action = null;
+            //action();
+            //action = null;
+            if (IsDrawerLockMode)
+            {
+                CommonPage.Instance.IsDrawerLockMode = false;
+            }
             RemoveUpdateControlDeviceStatuAction();
             base.RemoveFromParent();
         }
@@ -243,15 +274,6 @@
                 RemoveFromParent();
             };
 
-            var sharedBtn = new Button
-            {
-                X = Application.GetRealWidth(850),
-                Width = Application.GetMinReal(69),
-                Height = Application.GetMinReal(69),
-                Gravity = Gravity.CenterVertical,
-                UnSelectedImagePath = "Item/Shared.png"
-            };
-            top.topView.AddChidren(sharedBtn);
 
             var moreBtn = new Button
             {

--
Gitblit v1.8.0