From 2109463fab2eb1caed189e4f258e0e763c5cea7b Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期四, 07 十一月 2019 11:58:53 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev-tzy' into dev-wjc

---
 ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs |   29 ++++++++++++++++++++++++++---
 1 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs b/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
index 946630a..965a4d8 100755
--- a/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Light/LightControl.cs
@@ -145,7 +145,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 +180,8 @@
         public override void RemoveFromParent()
         {
             ZbGateway.StatusList.Remove(this);
-            action();
-            action = null;
+            //action();
+            //action = null;
             RemoveUpdateControlDeviceStatuAction();
             base.RemoveFromParent();
         }

--
Gitblit v1.8.0