黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
using Shared.Phone.UserCenter;
using System;
using System.Collections.Generic;
using System.Text;
 
namespace Shared.Phone.MainPage.Controls
{
    /// <summary>
    /// 设备功能菜单的图标控件
    /// </summary>
    public class DeviceFunctionMenuControl : FrameLayoutStatuControl
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 背景控件
        /// </summary>
        private PicViewControl btnBackGroud = null;
        /// <summary>
        /// 设备图标控件
        /// </summary>
        private IconViewControl btnDeviceIcon = null;
        /// <summary>
        /// 文本控件
        /// </summary>
        private NormalViewControl btnDeviceName = null;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 未分配界面的设备功能图标控件
        /// </summary>
        public DeviceFunctionMenuControl()
        {
            this.Width = Application.GetRealWidth(220);
            this.Height = Application.GetRealHeight(279);
            this.UseClickStatu = false;
        }
 
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="text">显示的文本</param>
        /// <param name="unSelectPath">图片1</param>
        /// <param name="selectPath">图片2</param>
        public void InitControl(string text, string unSelectPath, string selectPath)
        {
            //背景控件
            this.btnBackGroud = new PicViewControl(150, 173);
            btnBackGroud.Y = Application.GetRealHeight(35);
            btnBackGroud.Gravity = Gravity.CenterHorizontal;
            btnBackGroud.UnSelectedImagePath = "Item/Category_FunctionBG.png";
            btnBackGroud.SelectedImagePath = "Item/Category_FunctionBGSelected.png";
            this.AddChidren(btnBackGroud, ChidrenBindMode.BindEvent);
 
            //设备图标
            this.btnDeviceIcon = new IconViewControl(84);
            btnDeviceIcon.Y = Application.GetRealHeight(63);
            btnDeviceIcon.UnSelectedImagePath = unSelectPath;
            btnDeviceIcon.SelectedImagePath = selectPath;
            btnDeviceIcon.Gravity = Gravity.CenterHorizontal;
            this.AddChidren(btnDeviceIcon, ChidrenBindMode.BindEvent);
 
            //文本
            this.btnDeviceName = new NormalViewControl(170, 60, true);
            btnDeviceName.Y = Application.GetRealHeight(200);
            btnDeviceName.Gravity = Gravity.CenterHorizontal;
            btnDeviceName.TextColor = Common.ZigbeeColor.Current.GXCTextBlackColor;
            btnDeviceName.SelectedTextColor = Common.ZigbeeColor.Current.GXCTextSelectedColor;
            btnDeviceName.TextSize = 11;
            btnDeviceName.Text = text;
            btnDeviceName.TextAlignment = TextAlignment.Center;
            this.AddChidren(btnDeviceName, ChidrenBindMode.BindEvent);
        }
 
        #endregion
 
        #region ■ 设置状态___________________________
 
        /// <summary>
        /// 设置选择状态
        /// </summary>
        /// <param name="isSelect"></param>
        public void SetSelectStatu(bool isSelect)
        {
            this.btnBackGroud.IsSelected = isSelect;
            this.btnDeviceIcon.IsSelected = isSelect;
            this.btnDeviceName.IsSelected = isSelect;
            this.btnDeviceName.IsBold = isSelect;
        }
 
        #endregion
 
    }
}