gxc
2019-10-28 1c4904d77f484c075080942d87785481b52b6fb2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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 = string.Empty;
        /// <summary>
        /// 设备端点
        /// </summary>
        private int deviceEpoint = 0;
        /// <summary>
        /// 图标控件
        /// </summary>
        private NormalViewControl btnIcon = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 设备信息界面的设备图标控件
        /// </summary>
        /// <param name="i_device">设备回路对象</param>
        public DeviceInfoIconControl(CommonDevice i_device)
        {
            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);
        }
 
        /// <summary>
        /// 初始化
        /// </summary>
        public void InitControl()
        {
            //第二层底色
            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;
            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, Common.LocalDevice.Current.GetDevicesByMac(deviceMac));
            this.AddChidren(btnIcon);
        }
 
        #endregion
 
        #region ■ 一般方法___________________________
 
        /// <summary>
        /// 重新刷新控件
        /// </summary>
        public void RefreshControl()
        {
            //刷新图标
            Common.LocalDevice.Current.SetDeviceBeloneIconToControl(btnIcon, Common.LocalDevice.Current.GetDevicesByMac(deviceMac));
        }
 
        #endregion
    }
}