HDL Home App 第二版本 旧平台金堂用 正在使用
黄学彪
2020-01-06 72be4f06a683de33ddd563c8447c39f7f17e5b7d
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using System;
namespace Shared.Phone.Device.CommonForm
{
    /// <summary>
    /// 图片在左边,文字在右边,带下划线的行控件
    /// </summary>
    public class ACLeftIconButtonRowLayout : FrameLayout
    {
        #region ◆ 变量__________________________
        /// <summary>
        /// 图片
        /// </summary>
        public Button IconButton;
        /// <summary>
        /// 标题
        /// </summary>
        public Button TitleButton;
        /// <summary>
        /// 下划线
        /// </summary>
        public FrameLayout lineFrameLayout;
 
        #endregion
 
        #region ◆ 构造方法_______________________
 
        public ACLeftIconButtonRowLayout()
        {
 
        }
 
        #endregion
 
        #region ◆ 初始化__________________________
 
        /// <summary>
        /// 初始化--部分参数先写死吧
        /// </summary>
        /// <param name="iconPath">Icon path.</param>
        /// <param name="iconSelectedPath">Icon selected path.</param>
        /// <param name="title">Title.</param>
        public void Init(string iconPath, string iconSelectedPath, string title, bool hadLine = true)
        {
            IconButton = new Button()
            {
                X = Application.GetRealWidth(80),
                Height = Application.GetMinRealAverage(80),
                Width = Application.GetMinRealAverage(80),
                UnSelectedImagePath = iconPath,
                SelectedImagePath = iconSelectedPath,
                Gravity = Gravity.CenterVertical,
                Tag = this.Tag
            };
            AddChidren(IconButton);
 
            TitleButton = new Button()
            {
                X = IconButton.Right + Application.GetRealWidth(30),
                Height = Application.GetRealHeight(80),
                Width = this.Width - Application.GetRealWidth(80 + 80 + 30),
                TextColor = Shared.Common.ZigbeeColor.Current.GXCPlaceHolderTextColor,
                SelectedTextColor = Common.ZigbeeColor.Current.GXCACSelectedTextColor_FanModel,
                Text = title,
                TextAlignment = TextAlignment.CenterLeft,
                Gravity = Gravity.CenterVertical,
                Tag = this.Tag
            };
            AddChidren(TitleButton);
 
            lineFrameLayout = new FrameLayout()
            {
                X = IconButton.X,
                Y = this.Height - 1,
                Width = this.Width - IconButton.X,
                Height = 1,
                BackgroundColor = Common.ZigbeeColor.Current.GXCPlaceHolderTextColor
            };
            if (hadLine)
            {
                AddChidren(lineFrameLayout);
            }
        }
        #endregion
 
        #region ◆ 选中状态__________________________
 
        /// <summary>
        /// 设置状态
        /// </summary>
        /// <param name="statu"></param>
        public void SetStatu(bool statu)
        {
            IconButton.IsSelected = statu;
            TitleButton.IsSelected = statu;
        }
        /// <summary>
        /// 选中
        /// </summary>
        public void SetSelectedStatu()
        {
            IconButton.IsSelected = true;
            TitleButton.IsSelected = true;
        }
        /// <summary>
        /// 不选中
        /// </summary>
        public void SetUnSelectedStatu()
        {
            IconButton.IsSelected = false;
            TitleButton.IsSelected = false;
        }
        #endregion
    }
 
}