From a4924de3136289d10cabbf2f61a228387d44ded7 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期四, 07 十一月 2019 13:48:36 +0800
Subject: [PATCH] Merge branch 'dev-tzy' into DEV_GXC

---
 ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs |   57 ++++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 42 insertions(+), 15 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs
index b0c3624..1fb8732 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs
@@ -6,7 +6,7 @@
 namespace Shared.Phone.UserCenter
 {
     /// <summary>
-    /// 璁惧淇℃伅鐣岄潰鐨勮澶囧浘鏍囨帶浠�
+    /// 璁惧淇℃伅鐣岄潰鐨勮澶囧浘鏍囨帶浠�(鍏煎缃戝叧)
     /// </summary>
     public class DeviceInfoIconControl : FrameLayout
     {
@@ -15,11 +15,11 @@
         /// <summary>
         /// 璁惧Mac鍦板潃
         /// </summary>
-        private string deviceMac = string.Empty;
+        private string deviceMac = null;
         /// <summary>
-        /// 璁惧绔偣
+        /// 缃戝叧瀵硅薄
         /// </summary>
-        private int deviceEpoint = 0;
+        private ZbGateway zbGateway = null;
         /// <summary>
         /// 鍥炬爣鎺т欢
         /// </summary>
@@ -32,28 +32,26 @@
         /// <summary>
         /// 璁惧淇℃伅鐣岄潰鐨勮澶囧浘鏍囨帶浠�
         /// </summary>
-        /// <param name="i_device">璁惧鍥炶矾瀵硅薄</param>
-        public DeviceInfoIconControl(CommonDevice i_device)
+        public DeviceInfoIconControl()
         {
-            deviceMac = i_device.DeviceAddr;
-            deviceEpoint = i_device.DeviceEpoint;
-
             //绗竴灞傚簳鑹�
             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;
         }
 
         /// <summary>
-        /// 鍒濆鍖�
+        /// 鍒濆鍖�(璁惧)
         /// </summary>
-        public void InitControl()
+        /// <param name="i_device">璁惧瀵硅薄</param>
+        public void InitControl(CommonDevice i_device)
         {
+            this.deviceMac = i_device.DeviceAddr;
             //绗簩灞傚簳鑹�
             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);
 
@@ -61,6 +59,27 @@
             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);
+        }
+
+        /// <summary>
+        /// 鍒濆鍖�(缃戝叧)
+        /// </summary>
+        /// <param name="i_gateway">缃戝叧瀵硅薄</param>
+        public void InitControl(ZbGateway i_gateway)
+        {
+            this.zbGateway = i_gateway;
+            //绗簩灞傚簳鑹�
+            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);
+
+            //璁惧鍥炬爣
+            btnIcon = new NormalViewControl(Application.GetMinRealAverage(121), Application.GetMinRealAverage(121), false);
+            btnIcon.Gravity = Gravity.Center;
+            HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, i_gateway);
             this.AddChidren(btnIcon);
         }
 
@@ -73,8 +92,16 @@
         /// </summary>
         public void RefreshControl()
         {
-            //鍒锋柊鍥炬爣
-            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, Common.LocalDevice.Current.GetDevicesByMac(deviceMac));
+            if (this.deviceMac != null)
+            {
+                //鍒锋柊鍥炬爣
+                Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, Common.LocalDevice.Current.GetDevicesByMac(deviceMac));
+            }
+            else
+            {
+                //鍒锋柊鍥炬爣
+                HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, this.zbGateway);
+            }
         }
 
         #endregion

--
Gitblit v1.8.0