wxr
2020-07-06 23c075a9c27946773feccf05abc90489a6bf5203
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
using System;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class TopViewDiv
    {
        /// <summary>
        /// 父窗体
        /// </summary>
        FrameLayout baseView;
        /// <summary>
        /// 父窗体Dialog
        /// </summary>
        Dialog baseDialog;
        /// <summary>
        /// 内容区域
        /// </summary>
        FrameLayout contentView;
 
 
        /// <summary>
        /// 后退按钮
        /// </summary>
        Button btnBack;
 
        /// <summary>
        /// 标题名称
        /// </summary>
        string title;
 
        /// <summary>
        /// 后退时触发对事件
        /// </summary>
        Action backAction;
 
        public TopViewDiv(FrameLayout frame, string str)
        {
            baseView = frame;
            title = str;
        }
 
        /// <summary>
        /// 
        /// </summary>
        /// <param name="dialog">显示的dialog</param>
        /// <param name="frame">dialog的父窗体</param>
        /// <param name="str">标题文本</param>
        public TopViewDiv(Dialog dialog, FrameLayout frame, string str)
        {
            baseDialog = dialog;
            baseView = frame;
            title = str;
        }
 
 
        /// <summary>
        /// 向framelayout添加顶部区域
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="tilte"></param>
        public void LoadTopView()
        {
            contentView = new FrameLayout()
            {
                Height = Application.GetRealHeight(64),
                BackgroundColor = CSS_Color.TopViewColor,
            };
            baseView.AddChidren(contentView);
 
            btnBack = new Button()
            {
                X = Application.GetRealWidth(10),
                Y = Application.GetRealHeight(29),
                Width = Application.GetRealWidth(40),
                Height = Application.GetRealHeight(28),
                UnSelectedImagePath = "Public/BackIcon.png",
            };
            baseView.AddChidren(btnBack);
 
            Button btnTilte = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(30),
                Width = Application.GetRealWidth(150),
                Height = Application.GetRealHeight(25),
                TextAlignment = TextAlignment.Center,
                TextSize = CSS_FontSize.HeadlineFontSize,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Text = title
            };
            baseView.AddChidren(btnTilte);
 
 
            LoadEventList();
        }
        /// <summary>
        /// 拥有一个回调事件
        /// </summary>
        /// <param name="action"></param>
        public void LoadTopView(Action action)
        {
            backAction = action;
 
            LoadTopView();
        }
 
        /// <summary>
        /// 向framelayout添加顶部区域,拥有配置图标按钮
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="tilte"></param>
        public void LoadTopView(Function function, Action action)
        {
            backAction = action;
 
            LoadTopView();
 
            var btnSetting = new Button()
            {
                X = Application.GetRealWidth(337),
                Y = Application.GetRealHeight(29),
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/FuncInfoSetIcon.png",
            };
            contentView.AddChidren(btnSetting);
 
            btnSetting.MouseUpEventHandler += (sender, e) =>
            {
                LoadEvent_SkipFunctionSetting(function);
            };
        }
        /// <summary>
        /// 房间标题区域
        /// </summary>
        /// <param name="room"></param>
        /// <param name="skipAction"></param>
        public void LoadTopView(Room room,Action skipAction)
        {
            //backAction = action;
 
            LoadTopView();
 
            var btnSetting = new Button()
            {
                X = Application.GetRealWidth(337),
                Y = Application.GetRealHeight(29),
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/FuncInfoSetIcon.png",
            };
            contentView.AddChidren(btnSetting);
 
            btnSetting.MouseUpEventHandler += (sender, e) =>
            {
                skipAction();
            };
        }
 
        /// <summary>
        /// 向framelayout添加顶部区域,拥有添加图标的按钮
        /// </summary>
        /// <param name="frame"></param>
        /// <param name="tilte"></param>
        public void LoadTopView(string type, Action<string, string> callBack)
        {
            LoadTopView();
 
            var btnAddIcon = new Button()
            {
                X = Application.GetRealWidth(337),
                Y = Application.GetRealHeight(29),
                Width = Application.GetMinRealAverage(28),
                Height = Application.GetMinRealAverage(28),
                UnSelectedImagePath = "Public/AddIcon.png",
            };
            contentView.AddChidren(btnAddIcon);
 
            btnAddIcon.MouseUpEventHandler += (sender, e) =>
            {
                LoadEvent_AddEvent(type, callBack);
            };
        }
 
        /// <summary>
        /// 向framelayout添加顶部区域,拥有添加图标的按钮,返回有回调事件
        /// </summary>
        /// <param name="type"></param>
        /// <param name="callBack"></param>
        /// <param name="action"></param>
        public void LoadTopView(string type, Action<string, string> callBack,Action action)
        {
            LoadTopView(type, callBack);
 
            backAction = action;
        }
    }
}