JLChen
2020-11-26 8905afcbd6dbb859e79199be86a7c706a03307b0
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
using System;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    /// <summary>
    /// 通用ListIconCellView
    /// 支持定义 图标、主标题、go图标、下划线、点击事件
    /// </summary>
    public class ListIconCellView : FrameLayout
    {
        /// <summary>
        /// 图标按钮
        /// </summary>
        public Button BtnIcon;
        /// <summary>
        /// 标题
        /// </summary>
        public Button BtnTilte;
        /// <summary>
        /// 箭头图标按钮
        /// </summary>
        public Button BtnGo;
        /// <summary>
        /// 分割线
        /// </summary>
        public LineView LineView;
 
        /// <summary>
        /// 点击触发对事件
        /// </summary>
        public Action GoAction;
 
        /// <summary>
        /// 
        /// </summary>
        public ListIconCellView()
        {
            ShowView();
        }
 
        /// <summary>
        /// 
        /// </summary>
        void ShowView()
        {
            this.Height = Application.GetRealHeight(50);
            this.BackgroundColor = CSS_Color.MainBackgroundColor;
 
            BtnIcon = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(24),
                Height = Application.GetRealWidth(24),
                Gravity = Gravity.CenterVertical,
            };
            this.AddChidren(BtnIcon);
 
            /// <summary>
            /// 标题
            /// </summary>
            BtnTilte = new Button()
            {
                X = BtnIcon.Right + Application.GetRealWidth(12),
                Width = Application.GetRealWidth(278),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
            };
 
            this.AddChidren(BtnTilte);
 
 
            /// <summary>
            /// 前进图标
            /// </summary>
            BtnGo = new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
 
            LineView = new LineView();
            this.AddChidren(LineView);
            LineView.Y = this.Height - LineView.Height;
 
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                GoAction?.Invoke();
            };
            BtnTilte.MouseUpEventHandler = eventHandler;
            BtnGo.MouseUpEventHandler = eventHandler;
 
        }
    }
}