黄学彪
2020-12-17 6c0c799c1f5da2d215ec8d9df9b92b3d1948dc14
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
116
117
118
119
120
121
122
123
124
125
126
using System;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    /// <summary>
    /// 通用ListCellView
    /// 支持定义 主标题、副标题、go图标、下划线、点击事件
    /// </summary>
    public class ListCellView : FrameLayout
    {
        /// <summary>
        /// 标题
        /// </summary>
        public Button BtnTilte;
        /// <summary>
        /// 副标题
        /// </summary>
        public Button BtnSubtitle;
        /// <summary>
        /// 箭头图标
        /// </summary>
        public Button BtnGo;
        /// <summary>
        /// 分割线
        /// </summary>
        public LineView LineView;
        /// <summary>
        /// 点击触发对事件
        /// </summary>
        public Action GoAction;
 
 
        /// <summary>
        /// ListCellView 默认
        /// </summary>
        public ListCellView()
        {
            ShowView();
        }
 
        /// <summary>
        /// ListCellView 指定参数
        /// </summary>
        /// <param name="tilteText"></param>
        /// <param name="subtitleText"></param>
        /// <param name="action"></param>
        /// <param name="isShowImageBtn"></param>
        public ListCellView(string tilteText, string subtitleText, Action action, bool isShowImageBtn = true)
        {
 
            ShowView(tilteText, subtitleText, action, isShowImageBtn);
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tilteText"></param>
        /// <param name="subtitleText"></param>
        /// <param name="action"></param>
        /// <param name="isShowImageBtn"></param>
        void ShowView(string tilteText = "", string subtitleText = "", Action action = null, bool isShowImageBtn = true)
        {
            this.BackgroundColor = CSS_Color.MainBackgroundColor;
            this.Height = Application.GetRealHeight(50);
            this.GoAction = action;
            /// <summary>
            /// 标题
            /// </summary>
            BtnTilte = new Button()
            {
                X = Application.GetRealWidth(16),
                Width = Application.GetRealWidth(120),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                Text = tilteText,
            };
            this.AddChidren(BtnTilte);
            /// <summary>
            /// 副标题
            /// </summary>
            BtnSubtitle = new Button()
            {
                X = Application.GetRealWidth(100),
                Width = Application.GetRealWidth(230),
                TextAlignment = TextAlignment.CenterRight,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.TextFontSize,
                Text = subtitleText,
 
            };
            this.AddChidren(BtnSubtitle);
 
            /// <summary>
            /// 前进图标
            /// </summary>
            BtnGo = new Button()
            {
                X = Application.GetRealWidth(339),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
 
            if (isShowImageBtn)
            {
                this.AddChidren(BtnGo);
            }
 
            LineView = new LineView(this.Height);
            this.AddChidren(LineView);
 
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                GoAction?.Invoke();
            };
            BtnTilte.MouseUpEventHandler = eventHandler;
            BtnSubtitle.MouseUpEventHandler = eventHandler;
            BtnGo.MouseUpEventHandler = eventHandler;
 
        }
    }
}