wei
2021-01-11 b271bcceb1c4e718377ca86b6213816abcf7482a
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
using System;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class ColorTureLampPage : FrameLayout
    {
 
        #region 控件集合
        static ColorTureLampPage bodyView;
        /// <summary>
        /// 控制界面加载区域
        /// </summary>
        FrameLayout controlView;
        /// <summary>
        /// 功能备注
        /// </summary>
        Button btnFunctionName;
        /// <summary>
        /// 功能所属楼层、房间
        /// </summary>
        Button btnFromFoorAndRoom;
        /// <summary>
        /// 收藏按钮
        /// </summary>
        Button btnCollection;
        /// <summary>
        /// 调光控件
        /// </summary>
        WaveSeekBarOn dimmerBar;
        /// <summary>
        /// 亮度显示按钮
        /// </summary>
        Button btnBrightnessText;
        /// <summary>
        /// 渐变时间修改
        /// </summary>
        //DiyImageSeekBar barFadeTime;
        /// <summary>
        /// 色温的滑动控件
        /// </summary>
        SeekBarControl barColorTemplatrue;
        /// <summary>
        /// 开关按钮
        /// </summary>
        Button btnSwitch;
        /// <summary>
        /// 色温快捷方式按钮
        /// </summary>
        Button btnShortcut;
        #endregion
 
        #region 区域变量
        Light light;
        Button btnCollection_Out;
        Button btnFunctionName_Out;
        Button btnFromFloor_Out;
        bool onDimmerBar = false;
        /// <summary>
        /// 刷新显示信息
        /// </summary>
        Action actionRefresh;
        #endregion
 
        public override void RemoveFromParent()
        {
            base.RemoveFromParent();
            bodyView = null;
        }
 
        public ColorTureLampPage(Light func)
        {
            bodyView = this;
            light = func;
        }
 
        public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
        {
            btnCollection_Out = btnCollectionIcon;
            btnFunctionName_Out = btnFunctionNameOut;
            btnFromFloor_Out = btnFromFloorOut;
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            //new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView(light,null);
            //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.Lights), light);
 
            controlView = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(88),
                Width = Application.GetRealWidth(327),
                Height = Application.GetRealHeight(526),
                BackgroundImagePath = "Public/Fragmentbg.png",
            };
            bodyView.AddChidren(controlView);
 
            btnFunctionName = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(14),
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(37),
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.EmphasisFontSize_FirstLevel,
                Text = light.name,
            };
            controlView.AddChidren(btnFunctionName);
 
            btnFromFoorAndRoom = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = btnFunctionName.Bottom,
                Width = Application.GetRealWidth(270),
                Height = Application.GetRealHeight(21),
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Text = light.GetRoomListName()
            };
            controlView.AddChidren(btnFromFoorAndRoom);
 
            btnCollection = new Button()
            {
                X = Application.GetRealWidth(273),
                Y = Application.GetRealHeight(14),
                Width = Application.GetMinRealAverage(40),
                Height = Application.GetMinRealAverage(40),
                SelectedImagePath = "Collection/CollectionIcon.png",
                UnSelectedImagePath = "Collection/CollectionGrayIcon.png",
                IsSelected = light.collect
            };
            //controlView.AddChidren(btnCollection);
            //2020-12-16 如果是成员隐藏收藏功能
            if (!DB_ResidenceData.Instance.CurrentRegion.IsOthreShare)
            {
                controlView.AddChidren(btnCollection);
            }
 
            dimmerBar = new WaveSeekBarOn()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(108),
                Width = Application.GetRealWidth(142 - 16 -16),
                Height = Application.GetRealHeight(222),
                BorderColor = 0x00000000,
                CornerRadius = Application.GetRealWidth(20),
                BorderWidth = 0,
                Progress = light.brightness,
                IsProgressTextShow = false,
            };
            controlView.AddChidren(dimmerBar);
            if (light.trait_on_off.curValue.ToString() == "on")
            {
                dimmerBar.SetProgressBarColors(CSS_Color.AuxiliaryColor1, CSS_Color.AuxiliaryColor1);
            }
            else
            {
                dimmerBar.SetProgressBarColors(CSS_Color.DividingLineColor, CSS_Color.DividingLineColor);
            }
            dimmerBar.Progress = light.brightness;
            btnBrightnessText = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = ((100 - light.brightness) * Application.GetRealHeight(222  - 16) / 100) + Application.GetRealWidth(80),
                Width = Application.GetRealWidth(56),
                Height = Application.GetRealWidth(46),
                UnSelectedImagePath = "FunctionIcon/Light/BrightnessBg.png",
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_SecondaryLevel,
                Text = light.brightness + "%",
            };
            controlView.AddChidren(btnBrightnessText);
 
            #region 色温
            //色温
            var btnTempClolor = new Button();
            btnTempClolor.X = Application.GetRealWidth(35);
            btnTempClolor.Y = Application.GetRealHeight(306 +60);
            btnTempClolor.Width = Application.GetRealWidth(224);
            btnTempClolor.Height = Application.GetRealHeight(21);
            btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
            btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor;
            btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            btnTempClolor.TextID = StringId.ColorTemperature;
            controlView.AddChidren(btnTempClolor);
 
            //2700K
            var btnTempClolorMin = new Button();
            btnTempClolorMin.Y = btnTempClolor.Bottom + Application.GetRealHeight(9);
            btnTempClolorMin.Width = Application.GetRealWidth(54);
            btnTempClolorMin.Height = Application.GetRealHeight(21);
            btnTempClolorMin.Text = "2700K";
            btnTempClolorMin.TextAlignment = TextAlignment.CenterRight;
            btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
            btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            controlView.AddChidren(btnTempClolorMin);
 
            //滑动条的背景图片
            var btnColorTemplatrueBack = new Button();
            //需要减掉滑动条的左右间距
            btnColorTemplatrueBack.Width = Application.GetRealWidth(210 - 20 * 2);
            btnColorTemplatrueBack.Height = Application.GetRealHeight(8);
            btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal;
            btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png";
            controlView.AddChidren(btnColorTemplatrueBack);
            //滑动条控件
            barColorTemplatrue = new SeekBarControl();
            barColorTemplatrue.X = btnTempClolorMin.Right;
            barColorTemplatrue.Y = Application.GetRealHeight(340);
            barColorTemplatrue.MinValue = 27;
            barColorTemplatrue.MaxValue = 65;
            barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明
            barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
            barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
            controlView.AddChidren(barColorTemplatrue);
            barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2;
            //显示上方的Txt
            barColorTemplatrue.ShowCustomTextView(Application.GetRealWidth(50), CSS_FontSize.PromptFontSize_FirstLevel, CSS_Color.FirstLevelTitleColor);
            var cct = 27;
            int.TryParse(light.Attr_CCT.curValue.ToString(), out cct);
            barColorTemplatrue.Progress = cct;
            //设置初始值
            barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
 
            //变更背景图的Y轴坐标
            btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
 
            //6500K
            var btnTempClolorMax = new Button();
            btnTempClolorMax.Y = btnTempClolorMin.Y;
            btnTempClolorMax.X = barColorTemplatrue.Right;
            btnTempClolorMax.Width = Application.GetRealWidth(54);
            btnTempClolorMax.Height = Application.GetRealHeight(21);
            btnTempClolorMax.Text = "6500K";
            btnTempClolorMax.TextAlignment = TextAlignment.CenterLeft;
            btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
            btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            controlView.AddChidren(btnTempClolorMax);
 
            #endregion
 
            #region 渐变时间调节
            //var btnGradualChangeText = new Button()
            //{
            //    X = Application.GetRealWidth(35),
            //    Y = Application.GetRealHeight(385),
            //    Width = Application.GetRealWidth(224),
            //    Height = Application.GetRealHeight(21),
            //    TextAlignment = TextAlignment.CenterLeft,
            //    TextColor = CSS_Color.FirstLevelTitleColor,
            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            //    TextID = StringId.SpeedOfChange,
            //};
            //controlView.AddChidren(btnGradualChangeText);
 
            //var btnGradualChangeMinValuesText = new Button()
            //{
            //    X = Application.GetRealWidth(35),
            //    Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
            //    Width = Application.GetRealWidth(22),
            //    Height = Application.GetRealHeight(21),
            //    Text = "0s",
            //    TextAlignment = TextAlignment.CenterLeft,
            //    TextColor = CSS_Color.PromptingColor1,
            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            //};
            //controlView.AddChidren(btnGradualChangeMinValuesText);
 
            //barFadeTime = new DiyImageSeekBar()
            //{
            //    X = btnGradualChangeMinValuesText.Right,
            //    Y = Application.GetRealHeight(412 - 21) + Application.GetRealHeight(8),
            //    Width = Application.GetRealWidth(210),
            //    Height = Application.GetRealHeight(54),
            //    SeekBarViewHeight = Application.GetRealHeight(8),
            //    ThumbImagePath = "Public/ThumbImage.png",
            //    ThumbImageHeight = Application.GetRealHeight(54),
            //    ProgressBarColor = CSS_Color.MainColor,
            //    ProgressTextColor = CSS_Color.FirstLevelTitleColor,
            //    ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            //    ProgressBarUnitSring = "s",
            //    MaxValue = 10,
            //    Progress = light.fadeTime,
            //    SeekBarPadding = Application.GetRealWidth(20),
            //};
            //controlView.AddChidren(barFadeTime);
 
            //var btnGradualChangeMaxValuesText = new Button()
            //{
            //    X = barFadeTime.Right,
            //    Y = btnGradualChangeText.Bottom + Application.GetRealHeight(8),
            //    Width = Application.GetRealWidth(35),
            //    Height = Application.GetRealHeight(21),
            //    Text = "10s",
            //    TextAlignment = TextAlignment.CenterLeft,
            //    TextColor = CSS_Color.PromptingColor1,
            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            //};
            //controlView.AddChidren(btnGradualChangeMaxValuesText);
            #endregion
 
            btnSwitch = new Button()
            {
                X = Application.GetRealWidth(180),
                Y = Application.GetRealHeight(466),
                Width = Application.GetRealWidth(32),
                Height = Application.GetRealWidth(32),
                UnSelectedImagePath = "Public/PowerClose.png",
                SelectedImagePath = "Public/PowerOpen.png",
                IsSelected = light.trait_on_off.curValue.ToString() == "on",
            };
            controlView.AddChidren(btnSwitch);
 
            //色温的快捷方式图标
            btnShortcut = new Button();
            btnShortcut.X = Application.GetRealWidth(116);
            btnShortcut.Y = btnSwitch.Y;
            btnShortcut.Width = Application.GetRealWidth(32);
            btnShortcut.Height = Application.GetRealWidth(32);
            btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
            controlView.AddChidren(btnShortcut);
            btnShortcut.MouseUpEventHandler += (sender, e) =>
            {
                //显示色温的快捷方式的弹窗
                this.ShowColorTemperatrueShortcutView();
            };
 
            LoadEventList();
 
            new TopViewDiv(bodyView, Language.StringByID(StringId.Lights)).LoadTopView_FunctionTop(light, actionRefresh);
            new System.Threading.Thread(() =>
            {
                DriverLayer.Control.Ins.SendReadCommand(light);
            })
            { IsBackground = true }.Start();
        }
 
        /// <summary>
        /// 显示色温的快捷方式的弹窗
        /// </summary>
        private void ShowColorTemperatrueShortcutView()
        {
            //整个灰色界面
            var frameBack = new Dialog();
 
            var dialogBody = new FrameLayout();
            frameBack.AddChidren(dialogBody);
            dialogBody.MouseUpEventHandler = (sender, e) => {
                frameBack.Close();
            };
 
            frameBack.Show();
 
            //白色的背景(用图片整的)
            var frameWhite = new FrameLayout();
            frameWhite.X = Application.GetRealWidth(63);
            frameWhite.Y = Application.GetRealHeight(350);
            frameWhite.Width = Application.GetRealWidth(160);
            frameWhite.Height = Application.GetRealHeight(199);
            frameWhite.BackgroundImagePath = "FunctionIcon/Light/ColorTemperatrueQuickBack.png";
            frameBack.AddChidren(frameWhite);
 
            //快捷调节
            var btnAdjust = new Button();
            btnAdjust.X = Application.GetRealWidth(24);
            btnAdjust.Y = Application.GetRealHeight(19);
            btnAdjust.Width = Application.GetRealWidth(80);
            btnAdjust.Height = Application.GetRealHeight(24);
            btnAdjust.TextID = StringId.QuickAdjustment;
            btnAdjust.TextColor = CSS_Color.FirstLevelTitleColor;
            btnAdjust.TextSize = CSS_FontSize.SubheadingFontSize;
            frameWhite.AddChidren(btnAdjust);
            //线
            var btnLine = new Button();
            btnLine.Y = btnAdjust.Bottom + Application.GetRealHeight(9);
            btnLine.Height = 1;
            btnLine.Width = Application.GetRealWidth(112);
            btnLine.Gravity = Gravity.CenterHorizontal;
            btnLine.BackgroundColor = CSS_Color.BackgroundColor;
            frameWhite.AddChidren(btnLine);
 
            //温馨图标
            var btnCozyIcon = new Button();
            btnCozyIcon.X = Application.GetRealWidth(24);
            btnCozyIcon.Y = btnLine.Bottom + Application.GetRealHeight(10);
            btnCozyIcon.Width = Application.GetRealWidth(24);
            btnCozyIcon.Height = Application.GetRealWidth(24);
            btnCozyIcon.UnSelectedImagePath = "FunctionIcon/Light/CozyIcon.png";
            btnCozyIcon.SelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
            frameWhite.AddChidren(btnCozyIcon);
            btnCozyIcon.MouseUpEventHandler += (sender, e) =>
            {
                barColorTemplatrue.Progress = 27;
                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
                frameBack.Close();
                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                DriverLayer.Control.Ins.SendWriteCommand(light, d);
                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
            };
            //温馨 2700k
            var btnCozy = new Button();
            btnCozy.X = btnCozyIcon.Right + Application.GetRealWidth(12);
            btnCozy.Y = btnCozyIcon.Y;
            btnCozy.Width = Application.GetRealWidth(100);
            btnCozy.Height = Application.GetRealWidth(24);
            btnCozy.Text = Language.StringByID(StringId.Cozy) + " 2700K";
            btnCozy.TextSize = CSS_FontSize.TextFontSize;
            btnCozy.TextColor = CSS_Color.FirstLevelTitleColor;
            btnCozy.SelectedTextColor = CSS_Color.MainColor;
            btnCozy.TextAlignment = TextAlignment.CenterLeft;
            frameWhite.AddChidren(btnCozy);
            btnCozy.MouseUpEventHandler += (sender, e) =>
            {
                barColorTemplatrue.Progress = 27;
                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
                frameBack.Close();
                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                DriverLayer.Control.Ins.SendWriteCommand(light, d); barColorTemplatrue.Progress = 27;
                barColorTemplatrue.SetCustomText(barColorTemplatrue.Progress * 100 + "K");
                frameBack.Close();
                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/CozyIconOn.png";
            };
 
            //会客图标
            var btnMeetIcon = new Button();
            btnMeetIcon.X = Application.GetRealWidth(24);
            btnMeetIcon.Y = btnCozyIcon.Bottom + Application.GetRealHeight(20);
            btnMeetIcon.Width = Application.GetRealWidth(24);
            btnMeetIcon.Height = Application.GetRealWidth(24);
            btnMeetIcon.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIcon.png";
            btnMeetIcon.SelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
            frameWhite.AddChidren(btnMeetIcon);
            btnMeetIcon.MouseUpEventHandler += (sender, e) =>
            {
                barColorTemplatrue.Progress = 30;
                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
                frameBack.Close();
                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                DriverLayer.Control.Ins.SendWriteCommand(light, d);
                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
            };
 
            //会客 3000k
            var btnMeet = new Button();
            btnMeet.X = btnMeetIcon.Right + Application.GetRealWidth(12);
            btnMeet.Y = btnMeetIcon.Y;
            btnMeet.Width = Application.GetRealWidth(100);
            btnMeet.Height = Application.GetRealWidth(24);
            btnMeet.Text = Language.StringByID(StringId.MeetingGuests) + " 3000K";
            btnMeet.TextSize = CSS_FontSize.TextFontSize;
            btnMeet.TextColor = CSS_Color.FirstLevelTitleColor;
            btnMeet.SelectedTextColor = CSS_Color.MainColor;
            btnMeet.TextAlignment = TextAlignment.CenterLeft;
            frameWhite.AddChidren(btnMeet);
            btnMeet.MouseUpEventHandler += (sender, e) =>
            {
                barColorTemplatrue.Progress = 30;
                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
                frameBack.Close();
                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                DriverLayer.Control.Ins.SendWriteCommand(light, d);
                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/MeetingGuestsIconOn.png";
            };
 
            //阅读图标
            var btnReadIcon = new Button();
            btnReadIcon.X = Application.GetRealWidth(24);
            btnReadIcon.Y = btnMeetIcon.Bottom + Application.GetRealHeight(20);
            btnReadIcon.Width = Application.GetRealWidth(24);
            btnReadIcon.Height = Application.GetRealWidth(24);
            btnReadIcon.UnSelectedImagePath = "FunctionIcon/Light/ReadIcon.png";
            btnReadIcon.SelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
            frameWhite.AddChidren(btnReadIcon);
            btnReadIcon.MouseUpEventHandler += (sender, e) =>
            {
                barColorTemplatrue.Progress = 65;
                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
                frameBack.Close();
                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                DriverLayer.Control.Ins.SendWriteCommand(light, d);
                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
            };
            //阅读 6500k
            var btnRead = new Button();
            btnRead.X = btnReadIcon.Right + Application.GetRealWidth(12);
            btnRead.Y = btnReadIcon.Y;
            btnRead.Width = Application.GetRealWidth(100);
            btnRead.Height = Application.GetRealWidth(24);
            btnRead.Text = Language.StringByID(StringId.Reading) + " 6500K";
            btnRead.TextSize = CSS_FontSize.TextFontSize;
            btnRead.TextColor = CSS_Color.FirstLevelTitleColor;
            btnRead.SelectedTextColor = CSS_Color.MainColor;
            btnRead.TextAlignment = TextAlignment.CenterLeft;
            frameWhite.AddChidren(btnRead);
            btnRead.MouseUpEventHandler += (sender, e) =>
            {
                barColorTemplatrue.Progress = 65;
                light.Attr_CCT.curValue = barColorTemplatrue.Progress * 100;
                barColorTemplatrue.SetCustomText(light.Attr_CCT.curValue + "K");
                frameBack.Close();
                System.Collections.Generic.Dictionary<string, string> d = new System.Collections.Generic.Dictionary<string, string>();
                d.Add(FunctionAttributeKey.CCT, light.Attr_CCT.curValue.ToString());
                DriverLayer.Control.Ins.SendWriteCommand(light, d);
                btnShortcut.UnSelectedImagePath = "FunctionIcon/Light/ReadIconOn.png";
            };
            btnCozy.IsSelected = false;
            btnCozyIcon.IsSelected = false;
            btnMeet.IsSelected = false;
            btnMeetIcon.IsSelected = false;
            btnRead.IsSelected = false;
            btnReadIcon.IsSelected = false;
            if (light.Attr_CCT.curValue.ToString() == "2700")
            {
                btnCozy.IsSelected = true;
                btnCozyIcon.IsSelected = true;
            }
            if (light.Attr_CCT.curValue.ToString() == "3000")
            {
                btnMeet.IsSelected = true;
                btnMeetIcon.IsSelected = true;
            }
            if (light.Attr_CCT.curValue.ToString() == "6500")
            {
                btnRead.IsSelected = true;
                btnReadIcon.IsSelected = true;
            }
        }
 
        /// <summary>
        /// 左右滑动的进度条控件
        /// </summary>
        private class SeekBarControl : DiyImageSeekBar
        {
            #region ■ 变量声明___________________________
 
            /// <summary>
            /// 进度值改变,如果要设置初始进度值,此变量要在设置初始进度值之前进行设置(第一个参数0:滑动的时候,1:手指弹起的时候)
            /// </summary>
            public Action<int, int> ProgressChangedEvent = null;
            /// <summary>
            /// 进度条可用时的背景色
            /// </summary>
            private uint ProgressBarEnableColor = 0;
            /// <summary>
            /// 进度条不可用时的背景色(默认灰色)
            /// </summary>
            public uint ProgressBarUnEnableColor = 0xffe8e8e8;
            /// <summary>
            /// 当前可用状态
            /// </summary>
            private bool nowEnable = true;
            /// <summary>
            /// 控件能否使用
            /// </summary>
            public new bool Enable
            {
                set
                {
                    //状态没有改变
                    if (nowEnable == value) { return; }
                    nowEnable = value;
 
                    this.IsClickable = value;
                    if (value == true)
                    {
                        //原来的颜色
                        base.ProgressBarColor = ProgressBarEnableColor;
                    }
                    else
                    {
                        //灰色
                        base.ProgressBarColor = ProgressBarUnEnableColor;
                    }
                }
            }
 
            /// <summary>
            /// 进度条颜色
            /// </summary>
            public new uint ProgressBarColor
            {
                set
                {
                    ProgressBarEnableColor = value;
                    base.ProgressBarColor = value;
                }
            }
 
            private int m_SeekBarPadding = Application.GetRealWidth(20);
            /// <summary>
            /// 进度条与左右两边的边框的边距(重写底层属性)
            /// </summary>
            public new int SeekBarPadding
            {
                set
                {
                    m_SeekBarPadding = value;
                    base.SeekBarPadding = value;
                }
            }
 
            private int m_MaxValue = 0;
            /// <summary>
            /// 进度条最大值(重写底层属性)
            /// </summary>
            public new int MaxValue
            {
                set
                {
                    m_MaxValue = value;
                    base.MaxValue = value;
                }
            }
 
            private int m_MinValue = 0;
            /// <summary>
            /// 进度条最小值(重写底层属性)
            /// </summary>
            public new int MinValue
            {
                set
                {
                    m_MinValue = value;
                    base.MinValue = value;
                }
            }
            /// <summary>
            /// 上方显示的文本
            /// </summary>
            private Button btnTopView = null;
 
            #endregion
 
            #region ■ 初始化_____________________________
 
            /// <summary>
            /// 左右滑动的进度条控件
            /// </summary>
            /// <param name="i_width">宽度,非真实值</param>
            public SeekBarControl(int i_width = 210)
            {
                this.Width = Application.GetRealWidth(i_width);
                this.Height = Application.GetRealHeight(54);
                //圆球的宽度
                this.ThumbImageHeight = Application.GetRealHeight(54);
                this.ThumbImagePath = "Public/ThumbImage.png";
                //进度条的宽度
                this.SeekBarViewHeight = Application.GetRealHeight(8);
                //上方是否显示文本
                this.IsProgressTextShow = false;
                this.Gravity = Gravity.CenterHorizontal;
                //进度条颜色
                this.ProgressBarColor = CSS_Color.MainColor;
                //左右边距
                this.SeekBarPadding = Application.GetRealWidth(20);
 
                //进度条值改变事件
                this.OnProgressChangedEvent += this.MyProgressChangedEvent;
                //手指弹起事件
                this.OnStopTrackingTouchEvent += this.MyStopTrackingTouchEvent;
            }
 
            #endregion
 
            #region ■ 事件_______________________________
 
            /// <summary>
            /// 进度条值改变事件
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="value"></param>
            private void MyProgressChangedEvent(object sender, int value)
            {
                if (this.ProgressChangedEvent == null)
                {
                    this.OnProgressChangedEvent -= this.MyProgressChangedEvent;
                    return;
                }
 
                this.ProgressChangedEvent(0, value);
            }
 
            /// <summary>
            /// 手指弹起事件
            /// </summary>
            /// <param name="sender"></param>
            /// <param name="value"></param>
            private void MyStopTrackingTouchEvent(object sender, int value)
            {
                if (this.ProgressChangedEvent == null)
                {
                    this.OnStopTrackingTouchEvent -= this.MyStopTrackingTouchEvent;
                    return;
                }
                //弹起事件不需要判断时间
                this.ProgressChangedEvent(1, value);
            }
 
            #endregion
 
            #region ■ 自定义上方显示文本_________________
 
            /// <summary>
            /// 在上方显示自定义文本
            /// </summary>
            /// <param name="i_width">宽度(真实值)</param>
            /// <param name="textSize">文字大小</param>
            /// <param name="textColor">文字颜色</param>
            public void ShowCustomTextView(int i_width, int textSize, uint textColor)
            {
                if (this.btnTopView != null) { return; }
 
                int contrHeight = Application.GetRealHeight(24);
                this.btnTopView = new Button();
                btnTopView.Width = i_width;
                btnTopView.Height = contrHeight;
                btnTopView.TextColor = textColor;
                btnTopView.TextSize = textSize;
                btnTopView.TextAlignment = TextAlignment.Center;
                btnTopView.Y = this.Y - contrHeight + Application.GetRealHeight(20);
                //初始化时,X轴可以不用理会
 
                this.Parent.AddChidren(btnTopView);
            }
 
            /// <summary>
            /// 设置自定义文本信息
            /// </summary>
            /// <param name="i_text"></param>
            public void SetCustomText(string i_text)
            {
                if (this.btnTopView == null) { return; }
 
                this.btnTopView.Text = i_text;
                //滑条最左边的距离
                int XX = this.X + this.m_SeekBarPadding;
                //当前滑条所在的大致百分比
                int tempValue = this.Progress - this.m_MinValue;
                if (tempValue < 0) { tempValue = 0; }
                decimal persent = (decimal)tempValue / (this.m_MaxValue - this.m_MinValue);
                //当前滑条所在的大致位置
                XX += (int)((this.Width - this.m_SeekBarPadding * 2) * persent);
                //因为要居中,所以减掉自定义控件的宽度的一般
                XX = XX - this.btnTopView.Width / 2;
 
                this.btnTopView.X = XX;
            }
 
            #endregion
 
            #region ■ 一般方法___________________________
 
            /// <summary>
            /// 控件摧毁
            /// </summary>
            public override void RemoveFromParent()
            {
                this.ProgressChangedEvent = null;
                base.RemoveFromParent();
            }
 
            #endregion
        }
    }
}