JLChen
2020-11-23 0138387222867fb6259599959772f38f69863404
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
127
128
129
130
131
132
using System;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public class ListCellView : FrameLayout
    {
        /// <summary>
        /// 
        /// </summary>
        public Button btnTilte;
        /// <summary>
        /// 副标题
        /// </summary>
        public Button btnSubtitle;
        /// <summary>
        /// 箭头图标
        /// </summary>
        public Button btnImage;
 
        /// <summary>
        /// 
        /// </summary>
        public string tilteText;
        /// <summary>
        /// 
        /// </summary>
        public string subtitleText;
 
        /// <summary>
        /// 点击触发对事件
        /// </summary>
        public Action goAction;
 
        /// <summary>
        /// 
        /// </summary>
        public bool isShowImageBtn = true;
 
 
        /// <summary>
        /// 
        /// </summary>
        public ListCellView()
        {
            this.Height = Application.GetRealHeight(50);
            this.BackgroundColor = CSS_Color.MainBackgroundColor;
            ShowView();
        }
 
        /// <summary>
        /// 
        /// </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)
        {
            this.Height = Application.GetRealHeight(50);
            this.tilteText = tilteText;
            this.subtitleText = subtitleText;
            this.goAction = action;
            ShowView();
        }
 
        /// <summary>
        /// 
        /// </summary>
        void ShowView()
        {
            /// <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>
            btnImage = 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(btnImage);
            }
 
            var lineView = new LineView();
            this.AddChidren(lineView);
            lineView.Y = this.Height - lineView.Height;
 
            EventHandler<MouseEventArgs> eventHandler = (sender, e) =>
            {
                goAction?.Invoke();
            };
            btnTilte.MouseUpEventHandler = eventHandler;
            btnSubtitle.MouseUpEventHandler = eventHandler;
            btnImage.MouseUpEventHandler = eventHandler;
 
        }
    }
}