JLChen
2020-05-28 04bd96cbf5d12a4e4b116d2b05fd0d05ea81ee23
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
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
//using System;
//namespace Shared.SimpleControl.Phone
//{
//    public class UserSensorSettingPushPage : FrameLayout
//    {
//        public void ShowUserSensorSettingPushPage (System.Collections.Generic.List<Common> sensorList)
//        {
//            BackgroundColor = SkinStyle.Current.ViewColor;
//            #region 标题
//            var topView = new FrameLayout () {
//                Y = Application.GetRealHeight (36),
//                Height = Application.GetRealHeight (90),
//                BackgroundColor = SkinStyle.Current.MainColor
//            };
//            AddChidren (topView);
 
//            var title = new Button () {
//                TextAlignment = TextAlignment.Center,
//                //Text = room.Name,
//                TextID = R.MyInternationalizationString.SetPush,
//                TextColor = SkinStyle.Current.TextColor1,
//                TextSize = 19,
//            };
//            topView.AddChidren (title);
 
//            var logo = new Button () {
//                Width = Application.GetRealWidth (154),
//                Height = Application.GetRealHeight (90),
//                X = Application.GetRealWidth (486),
//                UnSelectedImagePath = MainPage.LogoString,
//            };
//            topView.AddChidren (logo);
//            var back = new Button () {
//                Height = Application.GetRealHeight (90),
//                Width = Application.GetRealWidth (85),
//                UnSelectedImagePath = "Item/Back.png",
//                SelectedImagePath = "Item/BackSelected.png",
//            };
//            topView.AddChidren (back);
//            back.MouseUpEventHandler += (sender, e) => {
//                (Parent as PageLayout).PageIndex -= 1;
//            };
//            #endregion
 
//            var bodyScrolView = new VerticalScrolViewLayout () {
//                Y = topView.Bottom,
//                Height = Application.GetRealHeight (Application.DesignHeight - 126)
//            };
//            AddChidren (bodyScrolView);
 
//            foreach (var common in sensorList) {
//                var device = common as Sensor;
//                RowLayout rowView = new RowLayout () {
//                    Height = Application.GetRealHeight (100),
//                };
//                bodyScrolView.AddChidren (rowView);
 
//                var btnPoint = new Button () {
//                    Width = Application.GetMinRealAverage (10),
//                    Height = Application.GetMinRealAverage (10),
//                    Radius = (uint)Application.GetMinRealAverage (5),
//                    X = Application.GetRealWidth (50),
//                    Gravity = Gravity.CenterVertical,
//                    BackgroundColor = SkinStyle.Current.TextColor1,
//                    SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
//                    //UnSelectedImagePath = "Item/Point.png",
//                    //SelectedImagePath = "Item/PointSelected.png",
//                };
//                rowView.AddChidren (btnPoint);
 
//                Button btnDeviceName = new Button () {
//                    Width = Application.GetRealWidth (300),
//                    X = Application.GetRealWidth (80),
//                    Text = device.Name,
//                    TextColor = SkinStyle.Current.TextColor1,
//                    SelectedTextColor = SkinStyle.Current.SelectedColor,
//                    TextAlignment = TextAlignment.CenterLeft,
//                };
//                rowView.AddChidren (btnDeviceName);
 
//                Button rightButton = new Button () {
//                    Width = Application.GetRealWidth (46),
//                    Height = Application.GetRealHeight (47),
//                    Gravity = Gravity.CenterVertical,
//                    X = Application.GetRealWidth (580),
//                    UnSelectedImagePath = "Item/Down.png",
//                    SelectedImagePath = "Item/DownSelected.png",
//                };
//                rowView.AddChidren (rightButton);
 
//                VerticalScrolViewLayout setRowList = new VerticalScrolViewLayout () {
//                    Height = 0,
//                    ScrollEnabled = false
//                };
//                bodyScrolView.AddChidren (setRowList);
 
//                EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
//                    if (rightButton.IsSelected) {
//                        btnPoint.IsSelected = rightButton.IsSelected = btnDeviceName.IsSelected = false;
//                        setRowList.Height = 0;
//                    } else {
//                        MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                        System.Threading.Tasks.Task.Run (() => {
//                            try {
//                                var pushRevertBytes = Control.ControlBytesSendHasReturn (Command.ReadSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 255 });
 
//                                Application.RunOnMainThread (() => {
//                                    if (pushRevertBytes == null) {
//                                        new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                        pushRevertBytes = new byte [27];
//                                    }
//                                    btnPoint.IsSelected = rightButton.IsSelected = btnDeviceName.IsSelected = true;
//                                    switch (device.Type) {
//                                    case DeviceType.SensorPM25:
//                                        setRowList.Height = Application.GetRealHeight (400);
//                                        RowLayout rowPM25 = new RowLayout () {
//                                            Height = Application.GetRealHeight (100),
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                        };
//                                        setRowList.AddChidren (rowPM25);
 
//                                        var btnPM25Type1 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTipPM25Level1,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowPM25.AddChidren (btnPM25Type1);
 
//                                        var btnPM25Push1 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [3] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowPM25.AddChidren (btnPM25Push1);
//                                        btnPM25Push1.MouseUpEventHandler += (btnPM25Push1a, btnPM25Push1e) => {
//                                            btnPM25Push1.IsSelected = !btnPM25Push1.IsSelected;
//                                            byte setPushValua = btnPM25Push1.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
//                                        RowLayout rowPM252 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowPM252);
 
//                                        var btnPM25Type2 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTipPM25Level2,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowPM252.AddChidren (btnPM25Type2);
 
//                                        var btnPM25Push2 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            Tag = "Switch",
//                                            IsSelected = pushRevertBytes [6] == 1 ? true : false,
//                                        };
//                                        rowPM252.AddChidren (btnPM25Push2);
//                                        btnPM25Push2.MouseUpEventHandler += (btnPM25Push2a, btnPM25Push2e) => {
//                                            btnPM25Push2.IsSelected = !btnPM25Push2.IsSelected;
//                                            byte setPushValua = btnPM25Push2.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
 
//                                        RowLayout rowPM253 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowPM253);
 
//                                        var btnPM25Type3 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTipPM25Level3,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowPM253.AddChidren (btnPM25Type3);
 
//                                        var btnPM25Push3 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [9] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowPM253.AddChidren (btnPM25Push3);
//                                        btnPM25Push3.MouseUpEventHandler += (btnPM25Push3a, btnPM25Push3e) => {
//                                            btnPM25Push3.IsSelected = !btnPM25Push3.IsSelected;
//                                            byte setPushValua = btnPM25Push3.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
//                                        RowLayout rowPM254 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowPM254);
 
//                                        var btnPM25Type4 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTipPM25Level4,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowPM254.AddChidren (btnPM25Type4);
 
//                                        var btnPM25Push4 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [9] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowPM254.AddChidren (btnPM25Push4);
//                                        btnPM25Push4.MouseUpEventHandler += (btnPM25Push3a, btnPM25Push3e) => {
//                                            btnPM25Push4.IsSelected = !btnPM25Push4.IsSelected;
//                                            byte setPushValua = btnPM25Push4.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
//                                        break;
//                                    case DeviceType.SensorCO2:
//                                        setRowList.Height = Application.GetRealHeight (400);
//                                        RowLayout rowCO2 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowCO2);
 
//                                        var btnCO2Type1 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTipCO2Level1,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowCO2.AddChidren (btnCO2Type1);
 
//                                        var btnCO2Push1 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [3] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowCO2.AddChidren (btnCO2Push1);
//                                        btnCO2Push1.MouseUpEventHandler += (btnCO2Push1a, btnCO2Push1e) => {
//                                            btnCO2Push1.IsSelected = !btnCO2Push1.IsSelected;
//                                            byte setPushValua = btnCO2Push1.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
 
//                                        RowLayout rowCO22 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowCO22);
 
//                                        var btnCO2Type2 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTipCO2Level2,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowCO22.AddChidren (btnCO2Type2);
 
//                                        var btnCO2Push2 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [6] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowCO22.AddChidren (btnCO2Push2);
//                                        btnCO2Push2.MouseUpEventHandler += (btnCO2Push2a, btnCO2Push2e) => {
//                                            btnCO2Push2.IsSelected = !btnCO2Push2.IsSelected;
//                                            byte setPushValua = btnCO2Push2.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
 
//                                        RowLayout rowCO23 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowCO23);
 
//                                        var btnCO2Type3 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTipCO2Level3,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowCO23.AddChidren (btnCO2Type3);
 
//                                        var btnCO2Push3 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [9] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowCO23.AddChidren (btnCO2Push3);
//                                        btnCO2Push3.MouseUpEventHandler += (btnCO2Push3a, btnCO2Push3e) => {
//                                            btnCO2Push3.IsSelected = !btnCO2Push3.IsSelected;
//                                            byte setPushValua = btnCO2Push3.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
//                                        RowLayout rowCO24 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowCO24);
 
//                                        var btnCO2Type4 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTipCO2Level4,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowCO24.AddChidren (btnCO2Type4);
 
//                                        var btnCO2Push4 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [12] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowCO24.AddChidren (btnCO2Push4);
//                                        btnCO2Push4.MouseUpEventHandler += (btnCO2Push4a, btnCO2Push4e) => {
//                                            btnCO2Push4.IsSelected = !btnCO2Push4.IsSelected;
//                                            byte setPushValua = btnCO2Push4.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
//                                        break;
//                                    case DeviceType.SensorTVOC:
 
//                                        setRowList.Height = Application.GetRealHeight (400);
//                                        RowLayout rowTVOC = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowTVOC);
 
//                                        var btnTVOCType1 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTVOCTipLevel1,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowTVOC.AddChidren (btnTVOCType1);
 
//                                        var btnTVOCPush1 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [3] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowTVOC.AddChidren (btnTVOCPush1);
//                                        btnTVOCPush1.MouseUpEventHandler += (btnTVOCPush1a, btnTVOCPush1e) => {
//                                            btnTVOCPush1.IsSelected = !btnTVOCPush1.IsSelected;
//                                            byte setPushValua = btnTVOCPush1.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
 
//                                        RowLayout rowTVOC2 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowTVOC2);
 
//                                        var btnTVOCType2 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTVOCTipLevel2,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowTVOC2.AddChidren (btnTVOCType2);
 
//                                        var btnTVOCPush2 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [6] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowTVOC2.AddChidren (btnTVOCPush2);
//                                        btnTVOCPush2.MouseUpEventHandler += (btnTVOCPush2a, btnTVOCPush2e) => {
//                                            btnTVOCPush2.IsSelected = !btnTVOCPush2.IsSelected;
//                                            byte setPushValua = btnTVOCPush2.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
 
//                                        RowLayout rowTVOC3 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowTVOC3);
 
//                                        var btnTVOCType3 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTVOCTipLevel3,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowTVOC3.AddChidren (btnTVOCType3);
 
//                                        var btnTVOCPush3 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [9] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowTVOC3.AddChidren (btnTVOCPush3);
//                                        btnTVOCPush3.MouseUpEventHandler += (btnTVOCPush3a, btnTVOCPush3e) => {
//                                            btnTVOCPush3.IsSelected = !btnTVOCPush3.IsSelected;
//                                            byte setPushValua = btnTVOCPush3.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
//                                        RowLayout rowTVOC4 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowTVOC4);
 
//                                        var btnTVOCType4 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTVOCTipLevel4,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowTVOC4.AddChidren (btnTVOCType4);
 
//                                        var btnTVOCPush4 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [12] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowTVOC4.AddChidren (btnTVOCPush4);
//                                        btnTVOCPush4.MouseUpEventHandler += (btnTVOCPush4a, btnTVOCPush4e) => {
//                                            btnTVOCPush4.IsSelected = !btnTVOCPush4.IsSelected;
//                                            byte setPushValua = btnTVOCPush4.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
//                                        break;
//                                    case DeviceType.SensorTemperature:
//                                        setRowList.Height = Application.GetRealHeight (200);
//                                        RowLayout rowTemperature = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowTemperature);
 
//                                        var btnTemperatureType1 = new Button () {
//                                            Width = Application.GetRealWidth (560),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.Overheat,
//                                            //TextID = R.MyInternationalizationString.Hot,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowTemperature.AddChidren (btnTemperatureType1);
 
//                                        var btnTempPush1 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [3] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowTemperature.AddChidren (btnTempPush1);
 
//                                        btnTempPush1.MouseUpEventHandler += (ddd, sss) => {
//                                            MainPage.Loading.Start ("Saving...");
//                                            byte setPushValua = btnTempPush1.IsSelected == true ? (byte)0 : (byte)1;
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
//                                                    Application.RunOnMainThread (() => {
//                                                        if (setPushRevertBytes == null) {
//                                                            new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TargetsSetFail), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                                        } else {
//                                                            if (btnTempPush1.IsSelected) {
//                                                                btnTempPush1.IsSelected = false;
//                                                            } else {
//                                                                btnTempPush1.IsSelected = true;
//                                                            }
//                                                        }
//                                                    });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
//                                        btnTemperatureType1.MouseUpEventHandler += (sender2, e2) => {
//                                            new UserSensorSettingTempPushDialog ().ShowSettingTempPushDialog (device, 0, pushRevertBytes, btnTemperatureType1);
//                                        };
 
//                                        RowLayout rowTemperature2 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowTemperature2);
 
//                                        var btnTemperatureType2 = new Button () {
//                                            Width = Application.GetRealWidth (560),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.Overcooling,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowTemperature2.AddChidren (btnTemperatureType2);
 
 
//                                        var btnTempPush2 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [6] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowTemperature2.AddChidren (btnTempPush2);
 
//                                        btnTempPush2.MouseUpEventHandler += (ddd, sss) => {
//                                            MainPage.Loading.Start ("Saving...");
//                                            byte setPushValua = btnTempPush2.IsSelected == true ? (byte)0 : (byte)1;
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
//                                                    Application.RunOnMainThread (() => {
//                                                        if (setPushRevertBytes == null) {
//                                                            new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TargetsSetFail), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                                        } else {
//                                                            if (btnTempPush2.IsSelected) {
//                                                                btnTempPush2.IsSelected = false;
//                                                            } else {
//                                                                btnTempPush2.IsSelected = true;
//                                                            }
//                                                        }
//                                                    });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
 
//                                        btnTemperatureType2.MouseUpEventHandler += (dd, ss) => {
//                                            new UserSensorSettingTempPushDialog ().ShowSettingTempPushDialog (device, 1, pushRevertBytes, btnTemperatureType2);
//                                        };
 
//                                        System.Threading.Tasks.Task.Factory.StartNew (() => {
//                                            try {
//                                                for (int i = 0; i < 2; i++) {
//                                                    int pushTemp = 0;
//                                                    var pushValuesRevertBytes = Control.ControlBytesSendHasReturn (Command.ReadSensorPushValues, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, (byte)i });
//                                                    if (pushValuesRevertBytes == null) {
//                                                        pushValuesRevertBytes = new byte [] { device.DevicePushType, (byte)i, 0, 0, 0, 255 };
//                                                    }
//                                                    if (i == 0) {
//                                                        pushTemp = pushValuesRevertBytes [4] * 256 + pushValuesRevertBytes [5];
//                                                    } else {
//                                                        pushTemp = pushValuesRevertBytes [2] * 256 + pushValuesRevertBytes [3];
//                                                    }
//                                                    string setTemp = (pushTemp > 32768 ? ((32768 - pushTemp) / 10).ToString () : ((pushTemp / 10).ToString ())) + "°";
//                                                    Application.RunOnMainThread (() => {
//                                                        if (i == 0) {
//                                                            btnTemperatureType1.Text  = Language.StringByID (R.MyInternationalizationString.TriggerTemp) + ":> " + setTemp ;
//                                                        } else {
//                                                            btnTemperatureType2.Text = Language.StringByID (R.MyInternationalizationString.TriggerTemp) + ":< " + setTemp ;
//                                                        }
//                                                    });
//                                                }
//                                            } catch { } finally { 
                                                
//                                            }
//                                        });
//                                        break;
//                                    case DeviceType.SensorHumidity:
//                                        setRowList.Height = Application.GetRealHeight (300);
//                                        RowLayout rowHumidity = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowHumidity);
 
//                                        var btnHumidityType1 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceHumidityTipLevel3,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowHumidity.AddChidren (btnHumidityType1);
 
//                                        var btnHumidityPush1 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [3] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowHumidity.AddChidren (btnHumidityPush1);
//                                        btnHumidityPush1.MouseUpEventHandler += (btnHumidityPush1a, btnHumidityPush1e) => {
//                                            btnHumidityPush1.IsSelected = !btnHumidityPush1.IsSelected;
//                                            byte setPushValua = btnHumidityPush1.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 0, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
//                                        RowLayout rowHumidity2 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowHumidity2);
 
//                                        var btnHumidityType2 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceTempTipLevel1,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowHumidity2.AddChidren (btnHumidityType2);
 
//                                        var btnHumidityPush2 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [6] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowHumidity2.AddChidren (btnHumidityPush2);
//                                        btnHumidityPush2.MouseUpEventHandler += (btnHumidityPush2a, btnHumidityPush2e) => {
//                                            btnHumidityPush2.IsSelected = !btnHumidityPush2.IsSelected;
//                                            byte setPushValua = btnHumidityPush2.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 1, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
 
 
//                                        RowLayout rowHumidity3 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowHumidity3);
 
//                                        var btnHumidityType3 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceHumidityTipLevel1,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowHumidity3.AddChidren (btnHumidityType3);
 
//                                        var btnHumidityPush3 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [9] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowHumidity3.AddChidren (btnHumidityPush3);
//                                        btnHumidityPush3.MouseUpEventHandler += (btnHumidityPush3a, btnHumidityPush3e) => {
//                                            btnHumidityPush3.IsSelected = !btnHumidityPush3.IsSelected;
//                                            byte setPushValua = btnHumidityPush3.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 2, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
//                                        //break;
 
//                                        RowLayout rowHumidity4 = new RowLayout () {
//                                            BackgroundColor = SkinStyle.Current.SubtitleView,
//                                            Height = Application.GetRealHeight (100),
//                                        };
//                                        setRowList.AddChidren (rowHumidity4);
 
//                                        var btnHumidityType4 = new Button () {
//                                            Width = Application.GetRealWidth (300),
//                                            X = Application.GetRealWidth (80),
//                                            TextID = R.MyInternationalizationString.SensorReferenceHumidityTipLevel2,
//                                            TextColor = SkinStyle.Current.TextColor1,
//                                            TextAlignment = TextAlignment.CenterLeft,
//                                        };
//                                        rowHumidity4.AddChidren (btnHumidityType4);
 
//                                        var btnHumidityPush4 = new Button () {
//                                            Width = Application.GetMinRealAverage (90),
//                                            Height = Application.GetMinRealAverage (53),
//                                            X = Application.GetRealWidth (640 - 90 - 20),
//                                            Y = Application.GetRealHeight (22),
//                                            UnSelectedImagePath = "Item/SwitchClose.png",
//                                            SelectedImagePath = "Item/SwitchOpen.png",
//                                            IsSelected = pushRevertBytes [9] == 1 ? true : false,
//                                            Tag = "Switch"
//                                        };
//                                        rowHumidity4.AddChidren (btnHumidityPush4);
//                                        btnHumidityPush4.MouseUpEventHandler += (btnHumidityPush4a, btnHumidityPush4e) => {
//                                            btnHumidityPush4.IsSelected = !btnHumidityPush4.IsSelected;
//                                            byte setPushValua = btnHumidityPush4.IsSelected == true ? (byte)1 : (byte)0;
//                                            MainPage.Loading.Start (Language.StringByID(R.MyInternationalizationString.load));
//                                            System.Threading.Tasks.Task.Run (() => {
//                                                try {
//                                                    var setPushRevertBytes = Control.ControlBytesSendHasReturn (Command.SetSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 3, setPushValua, 255, 255 });
//                                                } catch (Exception ex) {
//                                                    Console.WriteLine (ex.Message);
//                                                } finally {
//                                                    Application.RunOnMainThread (() => {
//                                                        MainPage.Loading.Hide ();
//                                                    });
//                                                }
//                                            });
//                                        };
//                                        break;
//                                    }
 
//                                });
//                            } catch { } finally {
//                                Application.RunOnMainThread (() => {
//                                    MainPage.Loading.Hide ();
//                                });
//                            }
//                        });
//                    }
//                };
 
//                rightButton.MouseUpEventHandler += eventHandler;
//                btnDeviceName.MouseUpEventHandler += eventHandler;
//                rowView.MouseUpEventHandler += eventHandler;
 
//            }
//        }
//    }
//}