From 9904031f5291daaf56985146bb671f25e18ebbdf Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 02 四月 2020 19:51:31 +0800
Subject: [PATCH] 最新代码

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs |   67 ++++++++++++++++++++++++++++-----
 1 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs
index c93d200..ac4866c 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs
@@ -8,7 +8,7 @@
     /// <summary>
     /// 璁惧淇℃伅鐣岄潰鐨勮澶囧浘鏍囨帶浠�(鍏煎缃戝叧)
     /// </summary>
-    public class DeviceInfoIconControl : FrameLayout
+    public class DeviceInfoIconControl : FrameLayoutControl
     {
         #region 鈻� 鍙橀噺澹版槑___________________________
 
@@ -16,6 +16,10 @@
         /// 璁惧Mac鍦板潃
         /// </summary>
         private string deviceMac = null;
+        /// <summary>
+        /// 璁惧绔偣
+        /// </summary>
+        private int deviceEpoint = -1;
         /// <summary>
         /// 缃戝叧瀵硅薄
         /// </summary>
@@ -38,7 +42,8 @@
             this.Height = Application.GetMinRealAverage(207);
             this.Width = Application.GetMinRealAverage(207);
             this.BackgroundColor = UserCenterColor.Current.White;
-            this.Radius = (uint)Application.GetMinRealAverage(207);
+            this.Radius = (uint)Application.GetMinRealAverage(207) / 2;
+            this.UseClickStatu = false;
         }
 
         /// <summary>
@@ -51,15 +56,44 @@
             //绗簩灞傚簳鑹�
             var btnIcon2 = new NormalViewControl(Application.GetMinRealAverage(184), Application.GetMinRealAverage(184), false);
             btnIcon2.BackgroundColor = 0xfffef1ed;
-            btnIcon2.Radius = (uint)Application.GetMinRealAverage(184);
+            btnIcon2.Radius = (uint)Application.GetMinRealAverage(184) / 2;
             btnIcon2.Gravity = Gravity.Center;
-            this.AddChidren(btnIcon2);
+            this.AddChidren(btnIcon2, ChidrenBindMode.BindEventOnly);
+
+            //璁惧鍥炬爣
+            var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
+            if (listDevice.Count == 0)
+            {
+                //瀵瑰簲鍗曠函鍙湁200鍥炶矾鐨勮澶�
+                listDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
+            }
+            btnIcon = new NormalViewControl(Application.GetMinRealAverage(121), Application.GetMinRealAverage(121), false);
+            btnIcon.Gravity = Gravity.Center;
+            Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice);
+            this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
+        }
+
+        /// <summary>
+        /// 鍒濆鍖�(璁惧绔偣)
+        /// </summary>
+        /// <param name="i_device">璁惧瀵硅薄</param>
+        public void InitControl(string deviceMacAddr, int epoint)
+        {
+            this.deviceMac = deviceMacAddr;
+            this.deviceEpoint = epoint;
+
+            //绗簩灞傚簳鑹�
+            var btnIcon2 = new NormalViewControl(Application.GetMinRealAverage(184), Application.GetMinRealAverage(184), false);
+            btnIcon2.BackgroundColor = 0xfffef1ed;
+            btnIcon2.Radius = (uint)Application.GetMinRealAverage(184) / 2;
+            btnIcon2.Gravity = Gravity.Center;
+            this.AddChidren(btnIcon2, ChidrenBindMode.BindEventOnly);
 
             //璁惧鍥炬爣
             btnIcon = new NormalViewControl(Application.GetMinRealAverage(121), Application.GetMinRealAverage(121), false);
             btnIcon.Gravity = Gravity.Center;
-            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, Common.LocalDevice.Current.GetDevicesByMac(deviceMac));
-            this.AddChidren(btnIcon);
+            Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, Common.LocalDevice.Current.GetDevice(deviceMacAddr, epoint));
+            this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
         }
 
         /// <summary>
@@ -72,15 +106,15 @@
             //绗簩灞傚簳鑹�
             var btnIcon2 = new NormalViewControl(Application.GetMinRealAverage(184), Application.GetMinRealAverage(184), false);
             btnIcon2.BackgroundColor = 0xfffef1ed;
-            btnIcon2.Radius = (uint)Application.GetMinRealAverage(184);
+            btnIcon2.Radius = (uint)Application.GetMinRealAverage(184) / 2;
             btnIcon2.Gravity = Gravity.Center;
-            this.AddChidren(btnIcon2);
+            this.AddChidren(btnIcon2, ChidrenBindMode.BindEventOnly);
 
             //璁惧鍥炬爣
             btnIcon = new NormalViewControl(Application.GetMinRealAverage(121), Application.GetMinRealAverage(121), false);
             btnIcon.Gravity = Gravity.Center;
             HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, i_gateway);
-            this.AddChidren(btnIcon);
+            this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly);
         }
 
         #endregion
@@ -92,10 +126,21 @@
         /// </summary>
         public void RefreshControl()
         {
-            if (this.deviceMac != null)
+            if (this.deviceEpoint != -1)
             {
                 //鍒锋柊鍥炬爣
-                Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, Common.LocalDevice.Current.GetDevicesByMac(deviceMac));
+                Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, Common.LocalDevice.Current.GetDevice(this.deviceMac, this.deviceEpoint));
+            }
+            else if (this.deviceMac != null)
+            {
+                //鍒锋柊鍥炬爣
+                var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac);
+                if (listDevice.Count == 0)
+                {
+                    //瀵瑰簲鍗曠函鍙湁200鍥炶矾鐨勮澶�
+                    listDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac));
+                }
+                Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice);
             }
             else
             {

--
Gitblit v1.8.0