old mode 100755
new mode 100644
| | |
| | | using System;
|
| | | using System.Collections.Generic;
|
| | | using System.Text;
|
| | | using ZigBee.Device;
|
| | |
|
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 设备信息界面的设备图标控件(兼容网关)
|
| | | /// </summary>
|
| | | public class DeviceInfoIconControl : FrameLayout
|
| | | {
|
| | | #region ■ 变量声明___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设备Mac地址
|
| | | /// </summary>
|
| | | private string deviceMac = null;
|
| | | /// <summary>
|
| | | /// 网关对象
|
| | | /// </summary>
|
| | | private ZbGateway zbGateway = null;
|
| | | /// <summary>
|
| | | /// 图标控件
|
| | | /// </summary>
|
| | | private NormalViewControl btnIcon = null;
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 初始化_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 设备信息界面的设备图标控件
|
| | | /// </summary>
|
| | | public DeviceInfoIconControl()
|
| | | {
|
| | | //第一层底色
|
| | | this.Height = Application.GetMinRealAverage(207);
|
| | | this.Width = Application.GetMinRealAverage(207);
|
| | | this.BackgroundColor = UserCenterColor.Current.White;
|
| | | this.Radius = (uint)Application.GetMinRealAverage(207) / 2;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 初始化(设备)
|
| | | /// </summary>
|
| | | /// <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) / 2;
|
| | | btnIcon2.Gravity = Gravity.Center;
|
| | | this.AddChidren(btnIcon2);
|
| | |
|
| | | //设备图标
|
| | | 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);
|
| | | }
|
| | |
|
| | | /// <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);
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 一般方法___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 重新刷新控件
|
| | | /// </summary>
|
| | | public void RefreshControl()
|
| | | {
|
| | | 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
|
| | | {
|
| | | //刷新图标
|
| | | HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, this.zbGateway);
|
| | | }
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | | }
|
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using ZigBee.Device; |
| | | |
| | | namespace Shared.Phone.UserCenter |
| | | { |
| | | /// <summary> |
| | | /// 设备信息界面的设备图标控件(兼容网关) |
| | | /// </summary> |
| | | public class DeviceInfoIconControl : FrameLayoutStatuControl |
| | | { |
| | | #region ■ 变量声明___________________________ |
| | | |
| | | /// <summary> |
| | | /// 设备Mac地址 |
| | | /// </summary> |
| | | private string deviceMac = null; |
| | | /// <summary> |
| | | /// 设备端点 |
| | | /// </summary> |
| | | private int deviceEpoint = -1; |
| | | /// <summary> |
| | | /// 网关对象 |
| | | /// </summary> |
| | | private ZbGateway zbGateway = null; |
| | | /// <summary> |
| | | /// 图标控件 |
| | | /// </summary> |
| | | private NormalViewControl btnIcon = null; |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 初始化_____________________________ |
| | | |
| | | /// <summary> |
| | | /// 设备信息界面的设备图标控件 |
| | | /// </summary> |
| | | public DeviceInfoIconControl() |
| | | { |
| | | //第一层底色 |
| | | this.Height = this.GetPictrueRealSize(207); |
| | | this.Width = this.GetPictrueRealSize(207); |
| | | this.BackgroundColor = UserCenterColor.Current.White; |
| | | this.Radius = (uint)this.GetPictrueRealSize(207) / 2; |
| | | this.UseClickStatu = false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化(设备) |
| | | /// </summary> |
| | | /// <param name="i_device">设备对象</param> |
| | | public void InitControl(CommonDevice i_device) |
| | | { |
| | | this.deviceMac = i_device.DeviceAddr; |
| | | //防止出现误差 |
| | | int iconWidth = this.GetPictrueRealSize(207) - this.GetPictrueRealSize(12) - this.GetPictrueRealSize(12); |
| | | //第二层底色 |
| | | var btnIcon2 = new NormalViewControl(iconWidth, iconWidth, false); |
| | | btnIcon2.BackgroundColor = 0xfffef1ed; |
| | | btnIcon2.Radius = (uint)iconWidth / 2; |
| | | btnIcon2.Gravity = Gravity.Center; |
| | | this.AddChidren(btnIcon2, ChidrenBindMode.BindEvent); |
| | | |
| | | //设备图标 |
| | | var listDevice = Common.LocalDevice.Current.GetDevicesByMac(deviceMac); |
| | | if (listDevice.Count == 0) |
| | | { |
| | | //对应单纯只有200回路的设备 |
| | | listDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac)); |
| | | } |
| | | btnIcon = new NormalViewControl(this.GetPictrueRealSize(121), this.GetPictrueRealSize(121), false); |
| | | btnIcon.Gravity = Gravity.Center; |
| | | Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice); |
| | | this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化(设备端点) |
| | | /// </summary> |
| | | /// <param name="i_device">设备对象</param> |
| | | public void InitControl(string deviceMacAddr, int epoint) |
| | | { |
| | | this.deviceMac = deviceMacAddr; |
| | | this.deviceEpoint = epoint; |
| | | //防止出现误差 |
| | | int iconWidth = this.GetPictrueRealSize(207) - this.GetPictrueRealSize(12) - this.GetPictrueRealSize(12); |
| | | //第二层底色 |
| | | var btnIcon2 = new NormalViewControl(iconWidth, iconWidth, false); |
| | | btnIcon2.BackgroundColor = 0xfffef1ed; |
| | | btnIcon2.Radius = (uint)iconWidth / 2; |
| | | btnIcon2.Gravity = Gravity.Center; |
| | | this.AddChidren(btnIcon2, ChidrenBindMode.BindEvent); |
| | | |
| | | //设备图标 |
| | | btnIcon = new NormalViewControl(this.GetPictrueRealSize(121), this.GetPictrueRealSize(121), false); |
| | | btnIcon.Gravity = Gravity.Center; |
| | | Common.LocalDevice.Current.SetDeviceIconToControl(btnIcon, Common.LocalDevice.Current.GetDevice(deviceMacAddr, epoint)); |
| | | this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化(网关) |
| | | /// </summary> |
| | | /// <param name="i_gateway">网关对象</param> |
| | | public void InitControl(ZbGateway i_gateway) |
| | | { |
| | | this.zbGateway = i_gateway; |
| | | //防止出现误差 |
| | | int iconWidth = this.GetPictrueRealSize(207) - this.GetPictrueRealSize(12) - this.GetPictrueRealSize(12); |
| | | //第二层底色 |
| | | var btnIcon2 = new NormalViewControl(iconWidth, iconWidth, false); |
| | | btnIcon2.BackgroundColor = 0xfffef1ed; |
| | | btnIcon2.Radius = (uint)iconWidth / 2; |
| | | btnIcon2.Gravity = Gravity.Center; |
| | | this.AddChidren(btnIcon2, ChidrenBindMode.BindEvent); |
| | | |
| | | //设备图标 |
| | | btnIcon = new NormalViewControl(this.GetPictrueRealSize(121), this.GetPictrueRealSize(121), false); |
| | | btnIcon.Gravity = Gravity.Center; |
| | | HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, i_gateway); |
| | | this.AddChidren(btnIcon, ChidrenBindMode.BindEvent); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region ■ 一般方法___________________________ |
| | | |
| | | /// <summary> |
| | | /// 重新刷新控件 |
| | | /// </summary> |
| | | public void RefreshControl() |
| | | { |
| | | 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); |
| | | if (listDevice.Count == 0) |
| | | { |
| | | //对应单纯只有200回路的设备 |
| | | listDevice.Add(Common.LocalDevice.Current.GetOTADevice(deviceMac)); |
| | | } |
| | | Common.LocalDevice.Current.SetDeviceObjectIconToControl(btnIcon, listDevice); |
| | | } |
| | | else |
| | | { |
| | | //刷新图标 |
| | | HdlGatewayLogic.Current.SetGatewayIcon(btnIcon, this.zbGateway); |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | } |
| | | } |