From 4ce5177289b1d34e467de9d8790836559cc5a09e Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期一, 18 十一月 2019 18:06:28 +0800
Subject: [PATCH] 合并了全部的代码

---
 ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs |   39 +++++++++++++++++++++++++++------------
 1 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
index ad78427..75e2850 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Device/DeviceListMainForm.cs
@@ -158,12 +158,8 @@
             //鏍规嵁MAC鍚堝苟璁惧鍒楄〃
             this.MargeAllDeviceByMac(listDevice);
 
-            Application.RunOnMainThread(() =>
+            HdlThreadLogic.Current.RunMain(() =>
             {
-                if (this.Parent == null)
-                {
-                    return;
-                }
                 var listOta = new List<OTADevice>();
                 foreach (var macAddress in this.dicRowInfo.Keys)
                 {
@@ -176,6 +172,7 @@
                     //娣诲姞璁惧鐨勮彍鍗曡
                     this.AddDeviceMenuRow(macAddress);
                 }
+
                 //娣诲姞搴曢儴闂撮殭
                 var frameTemp = new FrameLayout();
                 frameTemp.Height = Application.GetRealHeight(23);
@@ -215,10 +212,9 @@
             rowInfo.MenuRow = rowMenu;
             //鍚戝彸鍥炬爣
             var btnRight = rowMenu.frameTable.AddMostRightEmptyIcon(58, 58);
-            rowMenu.frameTable.ChangedChidrenBindMode(btnRight, ChidrenBindMode.NotBind);
-            btnRight.UseClickStatu = false;
             btnRight.UnSelectedImagePath = "Item/Next.png";
             btnRight.SelectedImagePath = "Item/Down.png";
+            rowMenu.frameTable.ChangedChidrenBindMode(btnRight, ChidrenBindMode.NotBind);
 
             //鎻愮ず鏂扮増鏈�
             var btnNew = new InformationTipView(rowMenu.btnIcon);
@@ -248,9 +244,21 @@
             //灞曞紑,鎶樺彔
             btnRight.ButtonClickEvent += (sender, e) =>
             {
-                btnRight.IsSelected = !btnRight.IsSelected;
-                //灞曞紑鎴栬�呮姌鍙犳槑缁嗗垪琛�
-                this.ShowDetailList(deviceMac, btnRight.IsSelected);
+                //鍥炶矾鏁板ぇ浜�1鎵嶅睍寮�
+                if (Common.LocalDevice.Current.GetDevicesCountByMac(deviceMac) > 1)
+                {
+                    btnRight.IsSelected = !btnRight.IsSelected;
+                    //灞曞紑鎴栬�呮姌鍙犳槑缁嗗垪琛�
+                    this.ShowDetailList(deviceMac, btnRight.IsSelected);
+                }
+                else
+                {
+                    btnNew.Visible = false;
+                    var form = new DeviceMacInfoEditorForm();
+                    form.AddForm(deviceMac);
+                    //鐣岄潰璺宠浆,璁板綍褰撳墠鐨勬鍦ㄦ搷浣滅殑璁惧鐨凪ac鍦板潃
+                    this.nowActionDeviceMac = deviceMac;
+                }
             };
 
             rowMenu.frameTable.ButtonClickEvent += (sender, e) =>
@@ -790,6 +798,11 @@
             if (this.dicRowInfo.ContainsKey(deviceAddr) == false)
             {
                 var localDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceAddr);
+                if (localDevice.Count == 0)
+                {
+                    //鍏ョ綉涔嬪悗锛屽張鎶婂畠鍒犱簡
+                    return;
+                }
                 var rowNewInfo = new DeviceObjRowInfo();
                 rowNewInfo.DeviceMac = deviceAddr;
                 rowNewInfo.MacName = Common.LocalDevice.Current.GetDeviceMacName(localDevice[0]);
@@ -798,8 +811,6 @@
 
                 //鍒涘缓鏂扮殑琛�
                 this.AddDeviceMenuRow(deviceAddr);
-
-                return;
             }
         }
 
@@ -1016,6 +1027,10 @@
             {
                 //鑾峰彇鏈湴缃戝叧瀵硅薄
                 ZbGateway zbway = HdlGatewayLogic.Current.GetLocalGateway(zbGatewayId);
+                if (zbway == null)
+                {
+                    return;
+                }
                 btnName.Text = HdlGatewayLogic.Current.GetGatewayName(zbway);
                 if (HdlGatewayLogic.Current.CheckGatewayOnlineByFlag(zbway) == false)
                 {

--
Gitblit v1.8.0