wxr
2023-06-30 95abe9c68247fb8213871a59be4b0f33830dc188
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
using System;
using System.Collections.Generic;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI
{
    public partial class GroupControlPage_V2 : FrameLayout
    {
        FrameLayout bodyView;
        GroupControl function;
 
        FrameLayout controlView;
 
        Button btnFunctionName;
        Button btnFromFoorAndRoom;
        Button btnCollection;
 
        Button btnCollection_Out;
        Button btnFunctionName_Out;
        Button btnFromFloor_Out;
 
        public GroupControlPage_V2(GroupControl groupControl)
        {
            bodyView = this;
            function = groupControl;
            if (function == null)
            {
                function = new GroupControl();
            }
        }
 
        public void LoadPage(Button btnCollectionIcon, Button btnFunctionNameOut, Button btnFromFloorOut)
        {
            btnCollection_Out = btnCollectionIcon;
            btnFunctionName_Out = btnFunctionNameOut;
            btnFromFloor_Out = btnFromFloorOut;
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
 
            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 = function.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 = function.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 = function.collect
            };
            controlView.AddChidren(btnCollection);
            btnCollection.MouseUpEventHandler += (sender, e) => {
                btnCollection.IsSelected = function.collect = btnCollection_Out.IsSelected = !btnCollection.IsSelected;
                function.CollectFunction();
            };
 
 
 
            //回退刷新信息事件
            new TopViewDiv(bodyView, Language.StringByID(StringId.CombinedDimming)).LoadTopView_SettingIcon( () => {
                var page = new AddGroupControlPage(function,
                        (newGC) => {
                            try
                            {
                                Application.RunOnMainThread(() =>
                                {
                                    if (newGC != null)
                                    {
                                        btnFunctionName.Text = btnFunctionName_Out.Text = function.name;
                                        function.roomIds = newGC.uids;
                                        btnFromFloor_Out.Text = btnFromFoorAndRoom.Text = newGC.GetUidListName();
                                    }
                                });
                            }
                            catch (Exception ex)
                            {
                                MainPage.Log($"刷新群控房间信息异常:{ex.Message}");
                            }
                        },()=> {
                            try
                            {
                                this.RemoveFromParent();
                                UI.HomePage.RefreshFunctionView();
                                UI.RoomPage.bodyView?.ReLoadPage();
                                UI.FunctionPage.bodyView?.ReLoadPage();
                            }
                            catch (Exception ex)
                            {
                                MainPage.Log($"群控刷新界面异常:\r\n{ex.Message}");
                            }
                        });
                MainPage.BasePageView.AddChidren(page);
                page.LoadPage();
                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
 
            });
 
            ShowContentView();
        }
 
        private void ShowContentView()
        {
            var hadDimming = false;
            var hadCCT = false;
            var hadRGB = false;
            var hadColorful = false;
 
            foreach (var temp in function.sids)
            {
                if (temp.spk == SPK.LightRGB)
                {
                    if (!hadColorful)
                    {
                        var lightGroupControl = FunctionList.List.GetLightList().Find((obj) => obj.sid == temp.sid);
                        if (lightGroupControl != null)
                        {
                            if (lightGroupControl.GetAttribute(FunctionAttributeKey.Colorful) != null)
                            {
                                hadColorful = true;
                            }
                        }
                    }
                    hadRGB = true;
                }
                else if (temp.spk == SPK.LightCCT)
                {
                    hadCCT = true;
                }
                else if (temp.spk == SPK.LightDimming)
                {
                    hadDimming = true;
                }
 
                if (hadDimming && hadCCT && hadRGB && hadColorful)
                {
                    break;
                }
            }
 
            //属性设置区域
            var attrView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(52),
                Width = Application.GetRealWidth(343),
                ScrollEnabled = false,
            };
            //属性设置区域高度
            int attrViewHight = Application.GetRealHeight(18 + 22);
 
 
            controlView.AddChidren(attrView);
            attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
 
 
            if (hadRGB)
            {
                hadCCT = true;
                LoadRgbAttrView(hadCCT,hadColorful);
            }
            else if (hadCCT)
            {
                LoadCctAttrView(attrView);
            }
            else if (hadDimming)
            {
                LoadDimmingAttrView(attrView);
            }
            
 
 
 
            var btnSwitch = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(466),
                Width = Application.GetMinRealAverage(32),
                Height = Application.GetMinRealAverage(32),
                UnSelectedImagePath = "Public/PowerClose.png",
                SelectedImagePath = "Public/PowerOpen.png",
            };
            controlView.AddChidren(btnSwitch);
            btnSwitch.MouseUpEventHandler = (sender, e) => {
                if (btnSwitch.IsSelected)
                {
                    btnSwitch.IsSelected = false;
                    var d = new Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.OnOff, "off");
                    function.Control(d);
                }
                else
                {
                    btnSwitch.IsSelected = true;
                    var d = new Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.OnOff, "on");
                    function.Control(d);
                }
            };
 
 
        }
 
        /// <summary>
        /// 加载调光属性设置控件
        /// </summary>
        /// <param name="attrView"></param>
        void LoadDimmingAttrView(VerticalScrolViewLayout attrView)
        {
            var dimmingView = new FrameLayout()
            {
                Height = Application.GetRealHeight(54 + 11)
            };
            attrView.AddChidren(dimmingView);
 
            #region 亮度调节
            var btnBrightnessText = new Button()
            {
                X = Application.GetRealWidth(35),
                Y = Application.GetRealHeight(1),
                Width = Application.GetRealWidth(224),
                Height = Application.GetRealHeight(25),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextID = StringId.Brightness,
            };
            btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + function.GetAttrState(FunctionAttributeKey.Brightness) + "%";
            dimmingView.AddChidren(btnBrightnessText);
 
 
            var btnMinValuesText = new Button()
            {
                X = Application.GetRealWidth(35),
                Y = btnBrightnessText.Bottom,
                Width = Application.GetRealWidth(40),
                Height = Application.GetRealHeight(21),
                Text = "0%",
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            dimmingView.AddChidren(btnMinValuesText);
 
            var dimmerBar = new DiyImageSeekBar()
            {
                X = Application.GetRealWidth(45 + 10),
                Y = Application.GetRealHeight(11),
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealHeight(54),
                SeekBarViewHeight = Application.GetRealHeight(8),
                ThumbImagePath = "Public/ThumbImage.png",
                ThumbImageHeight = Application.GetRealHeight(54),
                ProgressTextColor = CSS_Color.FirstLevelTitleColor,
                ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                ProgressBarColor = CSS_Color.AuxiliaryColor1,
                MaxValue = 100,
                SeekBarPadding = Application.GetRealWidth(20),
                IsProgressTextShow = false,
                ProgressChangeDelayTime = 0,
            };
            dimmingView.AddChidren(dimmerBar);
            dimmerBar.OnProgressChangedEvent = (sender, e) =>
            {
                btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
            };
            dimmerBar.OnStopTrackingTouchEvent = (sender, e) =>
            {
                btnBrightnessText.Text = Language.StringByID(StringId.Brightness) + " " + e + "%";
 
                var d = new Dictionary<string, string>();
                d.Add(FunctionAttributeKey.Brightness, e.ToString());
                function.Control(d);
            };
 
 
            var btnMaxValuesText = new Button()
            {
                X = dimmerBar.Right,
                Y = btnBrightnessText.Bottom,
                Width = Application.GetRealWidth(55),
                Height = Application.GetRealHeight(21),
                Text = "100%",
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            dimmingView.AddChidren(btnMaxValuesText);
            #endregion
 
        }
 
        /// <summary>
        /// 加载cct属性设置控件
        /// </summary>
        /// <param name="attrView"></param>
        void LoadCctAttrView(VerticalScrolViewLayout attrView)
        {
            #region 色温
            var cctView = new FrameLayout()
            {
                Height = Application.GetRealHeight(75 + 11)
            };
            attrView.AddChidren(cctView);
 
 
            //色温
            var btnTempClolor = new Button();
            btnTempClolor.X = Application.GetRealWidth(35);
            btnTempClolor.Y = Application.GetRealHeight(1);
            btnTempClolor.Width = Application.GetRealWidth(224);
            btnTempClolor.Height = Application.GetRealHeight(42);
            btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
            btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor;
            btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            btnTempClolor.TextID = StringId.ColorTemperature;
            cctView.AddChidren(btnTempClolor);
 
            //2700K
            var btnTempClolorMin = new Button()
            {
                X = Application.GetRealWidth(35),
                Y = btnTempClolor.Bottom,
                Width = Application.GetRealWidth(40),
                Height = Application.GetRealHeight(21),
            };
            btnTempClolorMin.Width = Application.GetRealWidth(54);
            btnTempClolorMin.Height = Application.GetRealHeight(21);
            btnTempClolorMin.Text = "2700K";
            btnTempClolorMin.TextAlignment = TextAlignment.CenterLeft;
            btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
            btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            cctView.AddChidren(btnTempClolorMin);
 
            //滑动条的背景图片
            var btnColorTemplatrueBack = new Button()
            {
                X = Application.GetRealWidth(55 + 22 + 15),
                Y = Application.GetRealHeight(11),
                Width = Application.GetRealWidth(180),
                Height = Application.GetRealHeight(54),
            };
            btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png";
            btnColorTemplatrueBack.Height = Application.GetRealHeight(8);
            btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal;
            cctView.AddChidren(btnColorTemplatrueBack);
            //滑动条控件
            var barColorTemplatrue = new CCTSeekBarControl()
            {
                X = Application.GetRealWidth(55 + 22),
                Y = Application.GetRealHeight(11),
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealHeight(54),
            };
            barColorTemplatrue.MinValue = 27;
            barColorTemplatrue.MaxValue = 65;
            barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明
            barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
            barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
            cctView.AddChidren(barColorTemplatrue);
            barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2;
            //设置初始值
            btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
            barColorTemplatrue.OnProgressChangedEvent = (sender, e) =>
            {
                btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
            };
            barColorTemplatrue.OnStopTrackingTouchEvent = (sender, e) =>
            {
                var d = new Dictionary<string, string>();
                d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
                function.Control(d);
            };
            //变更背景图的Y轴坐标
            btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
 
            //6500K
            var btnTempClolorMax = new Button();
            btnTempClolorMax.Y = btnTempClolorMin.Y;
            btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30);
            btnTempClolorMax.Width = Application.GetRealWidth(54);
            btnTempClolorMax.Height = Application.GetRealHeight(21);
            btnTempClolorMax.Text = "6500K";
            btnTempClolorMax.TextAlignment = TextAlignment.CenterRight;
            btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
            btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
            cctView.AddChidren(btnTempClolorMax);
 
            #endregion
        }
 
        /// <summary>
        /// 加载rgb属性设置控件
        /// </summary>
        /// <param name="attrView"></param>
        void LoadRgbAttrView(bool hadCCT,bool hadColorful)
        {
            Light lightTemp = new Light();
            int magriHeight = 0;
            if (hadCCT && hadColorful)
            {
                magriHeight = 80;
            }
 
            var btnCurColor = new Button()
            {
                X = Application.GetRealWidth(16),
                Y = Application.GetRealHeight(74),
                Width = Application.GetMinRealAverage(24),
                Height = Application.GetMinRealAverage(24),
                Radius = (uint)Application.GetMinRealAverage(8),
                BorderColor = CSS_Color.PromptingColor2,
                BorderWidth = 1,
                BackgroundColor = (uint)(0xFF000000 + lightTemp.GetRGBcolor(function.GetAttrState(FunctionAttributeKey.RGB)))
            };
            controlView.AddChidren(btnCurColor);
 
 
            //色盘的桌布控件(限制那个白色滑动球使用)
            var framePickerBack = new FrameLayout();
            framePickerBack.Gravity = Gravity.CenterHorizontal;
            framePickerBack.Y = btnFromFoorAndRoom.Bottom + Application.GetRealHeight(1);
            framePickerBack.Width = Application.GetMinRealAverage(216 - magriHeight);
            framePickerBack.Height = Application.GetMinRealAverage(216 - magriHeight);
            //framePickerBack.BackgroundColor = 0xFFFF0000;
            controlView.AddChidren(framePickerBack);
 
            var colorPicker = new ColorPicker()
            {
                Gravity = Gravity.Center,
                ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
            };
            framePickerBack.AddChidren(colorPicker);
            //if (function.trait_on_off.curValue.ToString() == "off")
            //{
            //    colorPicker.ColorImagePath = "FunctionIcon/Light/ColorWheelGray.png";
            //}
            //colorPicker.MouseDownEventHandler = (sender, e) => {
            //    MainPage.BasePageView.ScrollEnabled = false;
            //};
            //colorPicker.MouseUpEventHandler = (sender, e) => {
            //    MainPage.BasePageView.ScrollEnabled = true;
            //};
 
            //白点控件
            var diameter = Application.GetRealWidth(12);
            var btnWhiteRound = new Button()
            {
                Width = diameter,
                Height = diameter,
                Radius = (uint)Application.GetRealWidth(6),
                BorderWidth = (uint)Application.GetRealWidth(1),
                BorderColor = CSS_Color.MainBackgroundColor,
                Enable = false,
            };
            btnWhiteRound.Visible = false;
            framePickerBack.AddChidren(btnWhiteRound);
 
            #region 亮度调节
            var btnBrightnessText = new Button()
            {
                X = Application.GetRealWidth(35),
                Y = Application.GetRealHeight(308 - magriHeight),
                Width = Application.GetRealWidth(224),
                Height = Application.GetRealHeight(21),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextID = StringId.Brightness,
            };
            controlView.AddChidren(btnBrightnessText);
 
            var btnMinValuesText = new Button()
            {
                X = Application.GetRealWidth(35),
                Y = btnBrightnessText.Bottom,
                Width = Application.GetRealWidth(30),
                Height = Application.GetRealHeight(21),
                Text = "0%",
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            controlView.AddChidren(btnMinValuesText);
 
            var dimmerBar = new DiyImageSeekBar()
            {
                X = Application.GetRealWidth(35 + 22),
                Y = Application.GetRealHeight(312 - magriHeight),
                Width = Application.GetRealWidth(210),
                Height = Application.GetRealHeight(54),
                SeekBarViewHeight = Application.GetRealHeight(8),
                ThumbImagePath = "Public/ThumbImage.png",
                ThumbImageHeight = Application.GetRealHeight(54),
                ProgressTextColor = CSS_Color.FirstLevelTitleColor,
                ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                ProgressBarColor = CSS_Color.AuxiliaryColor1,
                MaxValue = 100,
                Progress = Convert.ToInt32(function.GetAttrState(FunctionAttributeKey.Brightness)),
                SeekBarPadding = Application.GetRealWidth(20),
            };
            controlView.AddChidren(dimmerBar);
 
            var btnMaxValuesText = new Button()
            {
                X = dimmerBar.Right,
                Y = btnBrightnessText.Bottom,
                Width = Application.GetRealWidth(45),
                Height = Application.GetRealHeight(21),
                Text = "100%",
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            controlView.AddChidren(btnMaxValuesText);
            #endregion
 
            int heightMore = 375 - magriHeight-20;
 
            if (hadCCT)
            {
                #region 色温
                var cctView = new FrameLayout()
                {
                    Y = Application.GetRealHeight(heightMore),
                    Height = Application.GetRealHeight(75 + 11)
                };
                controlView.AddChidren(cctView);
 
 
                //色温
                var btnTempClolor = new Button();
                btnTempClolor.X = Application.GetRealWidth(35);
                btnTempClolor.Y = Application.GetRealHeight(1);
                btnTempClolor.Width = Application.GetRealWidth(224);
                btnTempClolor.Height = Application.GetRealHeight(42);
                btnTempClolor.TextAlignment = TextAlignment.CenterLeft;
                btnTempClolor.TextColor = CSS_Color.FirstLevelTitleColor;
                btnTempClolor.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
                btnTempClolor.TextID = StringId.ColorTemperature;
                cctView.AddChidren(btnTempClolor);
 
                //2700K
                var btnTempClolorMin = new Button()
                {
                    X = Application.GetRealWidth(35),
                    Y = btnTempClolor.Bottom,
                    Width = Application.GetRealWidth(40),
                    Height = Application.GetRealHeight(21),
                };
                btnTempClolorMin.Width = Application.GetRealWidth(54);
                btnTempClolorMin.Height = Application.GetRealHeight(21);
                btnTempClolorMin.Text = "2700K";
                btnTempClolorMin.TextAlignment = TextAlignment.CenterLeft;
                btnTempClolorMin.TextColor = CSS_Color.PromptingColor1;
                btnTempClolorMin.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
                cctView.AddChidren(btnTempClolorMin);
 
                //滑动条的背景图片
                var btnColorTemplatrueBack = new Button()
                {
                    X = Application.GetRealWidth(55 + 22 + 15+5),
                    Y = Application.GetRealHeight(11),
                    Width = Application.GetRealWidth(170),
                    Height = Application.GetRealHeight(54),
                };
                btnColorTemplatrueBack.UnSelectedImagePath = "FunctionIcon/Light/ColorTemperatureBar.png";
                btnColorTemplatrueBack.Height = Application.GetRealHeight(8);
                btnColorTemplatrueBack.Gravity = Gravity.CenterHorizontal;
                cctView.AddChidren(btnColorTemplatrueBack);
                //滑动条控件
                var barColorTemplatrue = new CCTSeekBarControl()
                {
                    X = Application.GetRealWidth(55 + 25),
                    Y = Application.GetRealHeight(11),
                    Width = Application.GetRealWidth(215),
                    Height = Application.GetRealHeight(52),
                };
                barColorTemplatrue.MinValue = 27;
                barColorTemplatrue.MaxValue = 65;
                barColorTemplatrue.ProgressBarColor = 0x00000000;//全部透明
                barColorTemplatrue.ProgressBarUnEnableColor = 0x00000000;
                barColorTemplatrue.SeekBarBackgroundColor = 0x00000000;
                cctView.AddChidren(barColorTemplatrue);
                barColorTemplatrue.Y = btnTempClolorMin.Y - (barColorTemplatrue.Height - btnTempClolorMin.Height) / 2;
                //设置初始值
                btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
                barColorTemplatrue.OnProgressChangedEvent = (sender, e) =>
                {
                    btnTempClolor.Text = Language.StringByID(StringId.ColorTemperature) + " " + (barColorTemplatrue.Progress * 100 + "K");
                };
                barColorTemplatrue.OnStopTrackingTouchEvent = (sender, e) =>
                {
                    var d = new Dictionary<string, string>();
                    d.Add(FunctionAttributeKey.CCT, (barColorTemplatrue.Progress * 100).ToString());
                    function.Control(d);
                };
                //变更背景图的Y轴坐标
                btnColorTemplatrueBack.Y = barColorTemplatrue.Y + (barColorTemplatrue.Height - btnColorTemplatrueBack.Height) / 2;
 
                //6500K
                var btnTempClolorMax = new Button();
                btnTempClolorMax.Y = btnTempClolorMin.Y;
                btnTempClolorMax.X = barColorTemplatrue.Right - Application.GetRealWidth(30);
                btnTempClolorMax.Width = Application.GetRealWidth(54);
                btnTempClolorMax.Height = Application.GetRealHeight(21);
                btnTempClolorMax.Text = "6500K";
                btnTempClolorMax.TextAlignment = TextAlignment.CenterRight;
                btnTempClolorMax.TextColor = CSS_Color.PromptingColor1;
                btnTempClolorMax.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
                cctView.AddChidren(btnTempClolorMax);
 
                #endregion
 
 
                heightMore = 70;
 
            }
 
            if (hadColorful)
            {
                #region 炫彩功能
 
                var btnGradualChangeText = new Button()
                {
                    X = Application.GetRealWidth(35),
                    Y = Application.GetRealHeight(375 + heightMore - magriHeight),
                    Width = Application.GetRealWidth(224),
                    Height = Application.GetRealHeight(21),
                    TextAlignment = TextAlignment.CenterLeft,
                    TextColor = CSS_Color.FirstLevelTitleColor,
                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                    TextID = StringId.ColorfulFunction,
                };
                controlView.AddChidren(btnGradualChangeText);
 
                var btnGradualChangeMinValuesText = new Button()
                {
                    X = Application.GetRealWidth(35),
                    Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10),
                    Width = Application.GetRealWidth(22),
                    Height = Application.GetRealHeight(21),
                    UnSelectedImagePath = "Public/Edit.png",
                };
                controlView.AddChidren(btnGradualChangeMinValuesText);
                btnGradualChangeMinValuesText.MouseUpEventHandler = (sender, e) => {
                    var rgbView = new ColorfulInfoPage(function);
                    MainPage.BasePageView.AddChidren(rgbView);
                    rgbView.LoadPage();
                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
                };
 
                var barColorful = new FrameLayout()
                {
                    X = btnGradualChangeMinValuesText.Right + Application.GetRealWidth(15+5),
                    Y = Application.GetRealHeight(412 + heightMore - magriHeight),
                    Width = Application.GetRealWidth(170),
                    Height = Application.GetRealHeight(8),
                    BackgroundImagePath = "FunctionIcon/Light/ColorfulBar.png",
                };
                controlView.AddChidren(barColorful);
 
                var btnGradualChangeMaxValuesText = new Button()
                {
                    X = barColorful.Right + Application.GetRealWidth(8),
                    Y = btnGradualChangeText.Bottom + Application.GetRealHeight(10),
                    Width = Application.GetRealWidth(38),
                    Height = Application.GetRealHeight(24),
                    UnSelectedImagePath = "Public/Switch.png"
                };
                controlView.AddChidren(btnGradualChangeMaxValuesText);
                #endregion
 
 
            }
 
         
 
        }
 
 
        /// <summary>
        /// 检测点击点
        /// </summary>
        /// <param name="circleR">圆的半径</param>
        /// <param name="circleX">圆心X轴</param>
        /// <param name="circleY">圆心Y轴</param>
        /// <param name="pointX">点击点的X轴</param>
        /// <param name="pointY">点击点的Y轴</param>
        /// <returns></returns>
        private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY)
        {
            int dwidth = circleX - pointX;
            if (dwidth < 0) { dwidth *= -1; }
 
            int dHeight = circleY - pointY;
            if (dHeight < 0) { dHeight *= -1; }
 
            //根据三角函数,求三角形的斜边长
            int dlength = dwidth * dwidth + dHeight * dHeight;
            //半径长度(不开方,所以是按平方算)
            circleR *= circleR;
            if (dlength < circleR)
            {
                //如果组成的三角形并没有长过半径,则代表还在圆内(不允许点边界)
                return true;
            }
            return false;
        }
 
    }
}