From 5da99fed2eb0d08b6338064da5f998891252c7b8 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 18 五月 2020 16:39:59 +0800
Subject: [PATCH] 2020-05-18-2

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
index 3d6dcec..fcecdb3 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceObjectControl.cs
@@ -62,7 +62,7 @@
         /// 鍋氭垚涓�涓樉绀鸿澶囩被鍨�+璁惧MAC澶囨敞鐨凴owLayout
         /// </summary>
         /// <param name="i_deviceMac">璁惧鐨凪ac鍦板潃</param>
-        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(鐪熷疄鍊�,鏈変簺鐣岄潰闇�瑕佽繖绉嶇壒娈婃搷浣�)</param>
+        /// <param name="i_ChidrenYaxis">瀛愭帶浠禮杞村亸绉婚噺(銆愬垪琛ㄦ帶浠剁殑rowSpace/2銆戝嵆鍙�,涓嶆噦榛樿涓�0鍗冲彲)</param>
         public DeviceObjectControl(string i_deviceMac, int i_ChidrenYaxis = 0) : base(i_ChidrenYaxis)
         {
             this.deviceMac = i_deviceMac;
@@ -74,34 +74,29 @@
         public void InitControl()
         {
             var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac);
+            if (listDevice.Count == 0)
+            {
+                //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶�
+                listDevice.Add(Common.LocalDevice.Current.GetOTADevice(this.deviceMac));
+            }
             //鍥炬爣
             btnIcon = frameTable.AddLeftIcon(81);
-            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, listDevice);
+            Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice);
 
             //璁惧
             string deviceName = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
-            btnDeviceName = frameTable.AddLeftCaption(deviceName, 800, 60, true);
-            btnDeviceName.TextSize = 15;
-            //杩欎釜鍧愭爣鏈夌偣鐗规畩
-            btnDeviceName.Y = Application.GetRealHeight(12) + this.chidrenYaxis;
-            btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceObjectText(listDevice);
+            btnDeviceName = frameTable.AddTopView(deviceName, 800);
             frameTable.AddChidren(btnDeviceName, ChidrenBindMode.BindEventOnly);
 
             //鎴块棿
             string roomName = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
-            btnDeviceRoom = frameTable.AddLeftCaption(roomName, 800, 49, true);
-            //杩欎釜鍧愭爣鏈夌偣鐗规畩
-            btnDeviceRoom.Y = Application.GetRealHeight(72) + this.chidrenYaxis;
-            btnDeviceRoom.TextSize = 12;
-            btnDeviceRoom.TextColor = UserCenterColor.Current.TextGrayColor1;
-            btnDeviceRoom.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
-            frameTable.AddChidren(btnDeviceRoom, ChidrenBindMode.BindEventOnly);
+            btnDeviceRoom = frameTable.AddBottomView(roomName, 800);
 
             //搴曠嚎
             frameTable.AddBottomLine();
 
             //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-            this.isOnline = listDevice[0].IsOnline == 1;
+            this.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]);
         }
 
         #endregion
@@ -137,14 +132,19 @@
             hadRefresh = true;
 
             var listDevice = Common.LocalDevice.Current.GetDevicesByMac(this.deviceMac);
+            if (listDevice.Count == 0)
+            {
+                //閽堝鍗曠函鍙湁涓�涓�200绔偣鐨勮澶�
+                listDevice.Add(Common.LocalDevice.Current.GetOTADevice(this.deviceMac));
+            }
             //鍥炬爣
-            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, listDevice);
+            Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice);
             //璁惧
             btnDeviceName.Text = Common.LocalDevice.Current.GetDeviceMacName(listDevice[0]);
             //璁惧鎴块棿
             btnDeviceRoom.Text = Common.LocalDevice.Current.GeteRealDeviceRoomName(listDevice[0]);
             //璁剧疆鍦ㄧ嚎鐘舵�佺殑鐗规晥
-            this.isOnline = listDevice[0].IsOnline == 1;
+            this.isOnline = Common.LocalDevice.Current.CheckDeviceIsOnline(listDevice[0]);
         }
 
 

--
Gitblit v1.8.0