From 2029e64ec0491f7e511dc15bffaf821bfbabe2de Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 20 七月 2020 14:10:22 +0800
Subject: [PATCH] 上传一个很特别的新版本

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs |   61 +++++++++++++-----------------
 1 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index 1c30f0e..568ce9c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -625,7 +625,7 @@
         {
             lock (dicRowInfo)
             {
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
                     if (this.listView == null)
                     {
@@ -717,7 +717,7 @@
             }
 
             //鑾峰彇鍏ㄩ儴璁惧
-            int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway);
+            int result = LocalDevice.Current.SetDeviceToMemmoryByGateway(nowGateway, false);
             if (this.Parent == null)
             {
                 return;
@@ -754,7 +754,7 @@
                 //鍒锋柊缃戝叧鍦ㄧ嚎鐘舵��
                 HdlGatewayLogic.Current.RefreshGatewayOnlineStatu(new List<ZbGateway>() { zbGateway });
 
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
                     if (this.gatewayViewRow != null && this.gatewayViewRow.zbGatewayId == selectGwId)
                     {
@@ -782,7 +782,7 @@
             }
             if (gateWay.GwId == this.gatewayViewRow.zbGatewayId)
             {
-                Application.RunOnMainThread(() =>
+                HdlThreadLogic.Current.RunMain(() =>
                 {
                     //鐩稿悓鐨勭姸鎬�,涓嶉渶瑕佸啀娆″埛鏂�
                     if (this.gatewayViewRow.isOnline != online)
@@ -848,7 +848,7 @@
                                 this.ReceiveDeviceStatu(device);
                             }, ShowErrorMode.NO);
                         }
-                        System.Threading.Thread.Sleep(30);
+                        System.Threading.Thread.Sleep(50);
                     }
                 }
             });
@@ -1034,14 +1034,27 @@
         {
             if (this.dicRowInfo.ContainsKey(deviceAddr) == true)
             {
-                var row = this.dicRowInfo[deviceAddr];
-                row.MenuRow?.RefreshControlInfo(true);
-                //鏄庣粏
-                if (row.dicDetailRow != null)
+                var rowInfo = this.dicRowInfo[deviceAddr];
+                //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎 2020.01.13鍙樻洿:杩藉姞Ota璁惧鐨勫垽鏂�
+                if (LocalDevice.Current.GetDevicesByMac(deviceAddr).Count == 0
+                    && LocalDevice.Current.GetOTADevice(deviceAddr) == null)
                 {
-                    foreach (var detailRow in row.dicDetailRow.Values)
+                    //绉婚櫎鎺т欢
+                    rowInfo.dicDetailRow = null;
+                    rowInfo.frameTable.RemoveFromParent();
+
+                    this.dicRowInfo.Remove(deviceAddr);
+                }
+                else
+                {
+                    //鍒锋柊璁惧淇℃伅
+                    rowInfo.MenuRow?.RefreshControlInfo(true);
+                    if (rowInfo.dicDetailRow != null)
                     {
-                        detailRow.RefreshControlInfo();
+                        foreach (var contr in rowInfo.dicDetailRow.Values)
+                        {
+                            contr?.RefreshControlInfo();
+                        }
                     }
                 }
             }
@@ -1107,30 +1120,8 @@
         {
             if (this.nowActionDeviceMac != null)
             {
-                var rowInfo = this.dicRowInfo[nowActionDeviceMac];
-                //妫�娴嬭繖涓澶囨槸鍚﹁鍒犻櫎 2020.01.13鍙樻洿:杩藉姞Ota璁惧鐨勫垽鏂�
-                if (Common.LocalDevice.Current.GetDevicesByMac(nowActionDeviceMac).Count == 0
-                    && Common.LocalDevice.Current.GetOTADevice(nowActionDeviceMac) == null)
-                {
-                    //绉婚櫎鎺т欢
-                    rowInfo.dicDetailRow = null;
-                    rowInfo.frameTable.RemoveFromParent();
-
-                    this.dicRowInfo.Remove(nowActionDeviceMac);
-                    rowInfo = null;
-                }
-                else
-                {
-                    //鍒锋柊璁惧淇℃伅
-                    rowInfo.MenuRow?.RefreshControlInfo(true);
-                    if (rowInfo.dicDetailRow != null)
-                    {
-                        foreach (var contr in rowInfo.dicDetailRow.Values)
-                        {
-                            contr?.RefreshControlInfo();
-                        }
-                    }
-                }
+                //鍒锋柊鎸囧畾璁惧琛岀殑淇℃伅
+                this.RefreshDeviceRow(this.nowActionDeviceMac);
             }
             //娓呯┖璁板綍
             this.nowActionDeviceMac = null;

--
Gitblit v1.8.0