wei
2020-12-22 334daf8dc48d6798524162228ae9cbe221773010
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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
using System;
using Shared;
namespace HDL_ON.UI.UI2.Intelligence.Automation.LogicView
{
    public class BrightnessView
    {
        /// <summary>
        /// 主控件
        /// </summary>
        public FrameLayout frameLayout = new FrameLayout
        {
            Y = Application.GetRealHeight(467),
            Height = Application.GetRealHeight(56 + 124),
            Width = Application.GetRealWidth(343),
            X = Application.GetRealWidth(16),
            BackgroundColor = CSS.CSS_Color.view,
            Radius = (uint)Application.GetRealHeight(12),
        };
        /// <summary>
        /// 标题Btn
        /// </summary>
        public Button btnTitle = new Button
        {
            TextID = StringId.timeHorizon,
            TextSize = TextSize.text16,
            TextColor = CSS.CSS_Color.textColor,
            IsBold = true,
            Width = Application.GetRealWidth(343 - (52 + 4 + 10) * 2),
            Height = Application.GetRealHeight(22),
            Y = Application.GetRealHeight(17),
            X = Application.GetRealWidth(52 + 4 + 10)
        };
        /// <summary>
        /// 取消Btn
        /// </summary>
        public Button btnCancel = new Button
        {
            TextID = StringId.cancelSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textCancelColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            Y = Application.GetRealHeight(10),
            X = Application.GetRealWidth(4)
        };
        /// <summary>
        /// 确定Btn
        /// </summary>
        public Button btnConfirm = new Button
        {
            TextID = StringId.confirmSelected,
            TextSize = TextSize.text14,
            TextColor = CSS.CSS_Color.textConfirmColor,
            Width = Application.GetRealWidth(52),
            Height = Application.GetRealHeight(32),
            X = Application.GetRealWidth(343 - 4 - 52),
            Y = Application.GetRealHeight(10),
        };
        /// <summary>
        /// 图标-
        /// </summary>
        public Button btn_subtract = new Button
        {
            Width = Application.GetRealWidth(24),
            Height = Application.GetRealWidth(24),
            X = Application.GetRealWidth(26),
            Y = Application.GetRealHeight(118),
            UnSelectedImagePath = "LogicIcon/-.png",
        };
        /// <summary>
        /// 图标-扩大热键
        /// </summary>
        public Button btn_subtract_click = new Button
        {
            Width = Application.GetMinRealAverage(24 + 20),
            Height = Application.GetMinRealAverage(24),
            X = Application.GetRealWidth(26 - 20),
            Y = Application.GetRealHeight(118),
 
        };
        public DiyImageSeekBar seekBarVol = new DiyImageSeekBar
        {
            Y = Application.GetRealHeight(103),//进度条父控件Y坐标
            X = Application.GetRealWidth(62 - 10),//进度条X坐标
            SeekBarPadding = Application.GetRealHeight(10),//进度条实际长度=244-10*2(内边距);
            Width = Application.GetRealWidth(240),//进度条的长度
            Height = Application.GetRealHeight(54),//进度条父控件高度
            IsProgressTextShow = true,//显示百分比
            IsClickable = true,//进度条是否滑动
            ProgressBarColor = CSS.CSS_Color.textConfirmColor,//选中进度条颜色
            ThumbImagePath = "LogicIcon/point.png",//进度条按钮图标
            ThumbImageHeight = Application.GetRealHeight(54),//进度条按钮图标的高度(默认正方形:宽和高一样)
            ProgressTextColor = CSS.CSS_Color.textColor,
            ProgressTextSize = 10,//显示百分比字体大小
            SeekBarViewHeight = Application.GetRealHeight(8),//进度条的高度
        };
        /// <summary>
        /// 图标+
        /// </summary>
        public Button btn_add = new Button
        {
            Width = Application.GetRealWidth(24),
            Height = Application.GetRealWidth(24),
            X = Application.GetRealWidth(294),
            Y = Application.GetRealHeight(118),
            UnSelectedImagePath = "LogicIcon/+.png",
 
        };
        /// <summary>
        /// 图标+扩大热键
        /// </summary>
        public Button btn_add_click = new Button
        {
            Width = Application.GetMinRealAverage(24 + 20),
            Height = Application.GetMinRealAverage(24),
            X = Application.GetRealWidth(294),
            Y = Application.GetRealHeight(118),
        };
 
 
 
        /// <summary>
        /// View的方法
        /// </summary>
        /// <param name="fLayout">父控件</param>
        /// <param name="titleName">标题名称</param>
        /// <param name="stateValue">之前状态值</param>
        /// <param name="action">返回回调</param>
        public void FLayoutView(FrameLayout fLayout, string titleName,string stateValue, Action<string> action)
        {
            fLayout.AddChidren(frameLayout);
            frameLayout.AddChidren(btnTitle);
            frameLayout.AddChidren(btnCancel);
            frameLayout.AddChidren(btnConfirm);
            frameLayout.AddChidren(btn_subtract);
            frameLayout.AddChidren(btn_subtract_click);
            frameLayout.AddChidren(seekBarVol);
            frameLayout.AddChidren(btn_add);
            frameLayout.AddChidren(btn_add_click);
            btnTitle.Text = titleName;
            //第一个变化记录选中值
            int brightnesValue = 0;
            if (stateValue != "")
            {
                try
                {
                    //进来的状态
                    brightnesValue = int.Parse(stateValue);
                    seekBarVol.Progress = int.Parse(stateValue);
                }
                catch { }
            }
            //—点击事件
            btn_subtract_click.MouseUpEventHandler += (sender2, e2) =>
            {
                if (brightnesValue > 0)
                {
                    brightnesValue -= 1;
                    seekBarVol.Progress = brightnesValue;
                }
            };
            //+点击事件
            btn_add_click.MouseUpEventHandler += (sende2, e2) =>
            {
                if (brightnesValue < 100)
                {
                    brightnesValue += 1;
                    seekBarVol.Progress = brightnesValue;
 
                }
            };
            //进度条滑动点击事件
            EventHandler<int> progressclick = (sender2, e2) =>
            {
                brightnesValue = seekBarVol.Progress;
            };
            seekBarVol.OnProgressChangedEvent += progressclick;
            seekBarVol.OnStopTrackingTouchEvent += progressclick;
            //取消点击事件
            btnCancel.MouseUpEventHandler += (sender, e1) =>
            {
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
            //确定点击事件
            btnConfirm.MouseUpEventHandler += (sender, e1) =>
            {
                //if (brightnesValue == 0)
                //{
                //    return;
                //}
                action(brightnesValue.ToString());
                //移除fLayout界面
                fLayout.RemoveFromParent();
            };
 
 
        }
 
 
 
 
        ///// <summary>
        ///// View的方法
        ///// </summary>
        ///// <param name="fLayout"></param>
        //public void FLayoutView(FrameLayout fLayout)
        //{
        //    fLayout.AddChidren(frameLayout);
        //    frameLayout.AddChidren(btnTitle);
        //    frameLayout.AddChidren(btnCancel);
        //    frameLayout.AddChidren(btnConfirm);
        //    frameLayout.AddChidren(btn_subtract);
        //    frameLayout.AddChidren(btn_subtract_click);
        //    frameLayout.AddChidren(seekBarVol);
        //    frameLayout.AddChidren(btn_add);
        //    frameLayout.AddChidren(btn_add_click);
        //    //取消点击事件
        //    btnCancel.MouseUpEventHandler += (sender, e1) =>
        //    {
        //        //移除fLayout界面
        //        fLayout.RemoveFromParent();
        //    };
 
        //}
    }
}