From 18b93d511dc764b469d7c4a7e755f7274f89cdb4 Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期一, 27 四月 2020 17:55:14 +0800 Subject: [PATCH] 2020-4-27-1 --- ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs | 58 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 48 insertions(+), 10 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs b/ZigbeeApp/Shared/Phone/UserCenter/CommonBase/Controls/DeviceControls/DeviceInfoIconControl.cs index 91b3a36..7da740e 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> @@ -39,6 +43,7 @@ this.Width = Application.GetMinRealAverage(207); this.BackgroundColor = UserCenterColor.Current.White; this.Radius = (uint)Application.GetMinRealAverage(207) / 2; + this.UseClickStatu = false; } /// <summary> @@ -48,12 +53,14 @@ public void InitControl(CommonDevice i_device) { this.deviceMac = i_device.DeviceAddr; + //闃叉鍑虹幇璇樊 + int iconWidth = Application.GetMinRealAverage(207) - Application.GetMinRealAverage(12) - Application.GetMinRealAverage(12); //绗簩灞傚簳鑹� - var btnIcon2 = new NormalViewControl(Application.GetMinRealAverage(184), Application.GetMinRealAverage(184), false); + var btnIcon2 = new NormalViewControl(iconWidth, iconWidth, false); btnIcon2.BackgroundColor = 0xfffef1ed; - btnIcon2.Radius = (uint)Application.GetMinRealAverage(184) / 2; + btnIcon2.Radius = (uint)iconWidth / 2; btnIcon2.Gravity = Gravity.Center; - this.AddChidren(btnIcon2); + this.AddChidren(btnIcon2, ChidrenBindMode.BindEventOnly); //璁惧鍥炬爣 var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); @@ -65,7 +72,31 @@ btnIcon = new NormalViewControl(Application.GetMinRealAverage(121), Application.GetMinRealAverage(121), false); btnIcon.Gravity = Gravity.Center; Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice); - this.AddChidren(btnIcon); + 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; + //闃叉鍑虹幇璇樊 + int iconWidth = Application.GetMinRealAverage(207) - Application.GetMinRealAverage(12) - Application.GetMinRealAverage(12); + //绗簩灞傚簳鑹� + var btnIcon2 = new NormalViewControl(iconWidth, iconWidth, false); + btnIcon2.BackgroundColor = 0xfffef1ed; + btnIcon2.Radius = (uint)iconWidth / 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.SetDeviceIconToControl(btnIcon, Common.LocalDevice.Current.GetDevice(deviceMacAddr, epoint)); + this.AddChidren(btnIcon, ChidrenBindMode.BindEventOnly); } /// <summary> @@ -75,18 +106,20 @@ public void InitControl(ZbGateway i_gateway) { this.zbGateway = i_gateway; + //闃叉鍑虹幇璇樊 + int iconWidth = Application.GetMinRealAverage(207) - Application.GetMinRealAverage(12) - Application.GetMinRealAverage(12); //绗簩灞傚簳鑹� - var btnIcon2 = new NormalViewControl(Application.GetMinRealAverage(184), Application.GetMinRealAverage(184), false); + var btnIcon2 = new NormalViewControl(iconWidth, iconWidth, false); btnIcon2.BackgroundColor = 0xfffef1ed; - btnIcon2.Radius = (uint)Application.GetMinRealAverage(184) / 2; + btnIcon2.Radius = (uint)iconWidth / 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 @@ -98,7 +131,12 @@ /// </summary> public void RefreshControl() { - if (this.deviceMac != null) + if (this.deviceEpoint != -1) + { + //鍒锋柊鍥炬爣 + 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); -- Gitblit v1.8.0