| | |
| | | namespace Shared.Phone.UserCenter
|
| | | {
|
| | | /// <summary>
|
| | | /// 设备信息界面的设备图标控件
|
| | | /// 设备信息界面的设备图标控件(兼容网关)
|
| | | /// </summary>
|
| | | public class DeviceInfoIconControl : FrameLayout
|
| | | {
|
| | |
| | | /// <summary>
|
| | | /// 设备Mac地址
|
| | | /// </summary>
|
| | | private string deviceMac = string.Empty;
|
| | | private string deviceMac = null;
|
| | | /// <summary>
|
| | | /// 设备端点
|
| | | /// 网关对象
|
| | | /// </summary>
|
| | | private int deviceEpoint = 0;
|
| | | private ZbGateway zbGateway = null;
|
| | | /// <summary>
|
| | | /// 图标控件
|
| | | /// </summary>
|
| | |
| | | /// <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);
|
| | |
| | | }
|
| | |
|
| | | /// <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;
|
| | |
| | | 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);
|
| | | 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>
|
| | | 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
|