wxr
2022-12-14 a61775710f8c4466db5bfce58af58f886d58edf3
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
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
//using System;
//namespace Shared.SimpleControl.Phone
//{
//    public class SystemRCU : FrameLayout
//    {
//        byte [] gatewayInfo;
//        void UpdateBaseInfo (RCU gateway)
//        {
//            System.Threading.Tasks.Task.Run (() => {
//                Application.RunOnMainThread (() => {
//                    MainPage.Loading.Start ("Sending...");
//                });
//                if (gatewayInfo == null) {
//                    CommonPage.RandomHigh = (byte)new Random ().Next (255);
//                    CommonPage.RandomLow = (byte)new Random ().Next (255);
//                    gatewayInfo = Control.ControlBytesSendHasReturn (Command.ReadGateway, gateway.SubnetID, gateway.DeviceID, new byte [] { CommonPage.RandomHigh, CommonPage.RandomLow });
//                }
//                if (gatewayInfo == null) {
//                    Application.RunOnMainThread (() => {
//                        MainPage.Loading.Hide ();
//                        new Alert ("",
//                                  Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline),
//                                   Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                    });
//                    return;
//                }
//                byte [] bytes = new byte [gatewayInfo.Length - 2];
//                Array.Copy (gatewayInfo, 2, bytes, 0, gatewayInfo.Length - 2);
//                //Remark需要解码
//                byte [] ddd = new byte [20];
//                byte [] ddd2 = CommonPage.MyEncodingGB2312.GetBytes (gateway.Name);
//                Array.Copy (ddd2, 0, ddd, 0, 20 < ddd2.Length ? 20 : ddd2.Length);
//                Array.Copy (ddd, 0, bytes, 11, 20 < ddd.Length ? 20 : ddd.Length);
//                string [] ipAddress = gateway.IPAddress.Split ('.');
//                for (int i = 0; i < ipAddress.Length; i++)
//                    bytes [i + 31] = byte.Parse (ipAddress [i]);
//                string [] r = gateway.RouteIPAddress.Split ('.');
//                for (int i = 0; i < r.Length; i++)
//                    bytes [i + 35] = byte.Parse (r [i]);
//                string [] subnetMask = gateway.SubnetMask.Split ('.');
//                for (int i = 0; i < subnetMask.Length; i++)
//                    bytes [i + 45] = byte.Parse (subnetMask [i]);
//                bytes [49] = gateway.DHCP == true ? (byte)1 : (byte)0;
//                var reBytes = Control.ControlBytesSendHasReturn (Command.SetGateway, gateway.SubnetID, gateway.DeviceID, bytes);
//                if (reBytes == null) {
//                    Application.RunOnMainThread (() => {
//                        MainPage.Loading.Hide ();
//                        new Alert ("",
//                                  Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline),
//                                   Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                    });
//                } else {
//                    Application.RunOnMainThread (() => {
//                        IO.FileUtils.SaveEquipmentMessage (gateway);
//                        MainPage.Loading.Hide ();
//                    });
//                }
//            });
//        }
 
//        public void ShowRCU (RCU gatewayDevice)
//        {
//            RemoveAll ();
//            MainPage.Loading.Start ("Please wait...");
 
//            if (!CommonPage.IsRemote) {
//                CommonPage.FindGatewayChilrenIPAddress = gatewayDevice.IPAddress;
//            }
//            CommonPage.RandomHigh = (byte)new Random ().Next (255);
//            CommonPage.RandomLow = (byte)new Random ().Next (255);
//            System.Threading.Tasks.Task.Run (() => {
//                gatewayInfo = Control.ControlBytesSendHasReturn (Command.ReadGateway, gatewayDevice.SubnetID, gatewayDevice.DeviceID, new byte [] { CommonPage.RandomHigh, CommonPage.RandomLow });
//                Application.RunOnMainThread (() => {
//                    MainPage.Loading.Hide ();
//                    if (gatewayInfo == null) {
//                        new Alert ("",
//                                  Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline),
//                                   Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                        return;
//                    } else {
//                        var one = IO.FileUtils.ReadEquipmentMessage (gatewayDevice);
//                        gatewayDevice = Newtonsoft.Json.JsonConvert.DeserializeObject<RCU> (one);
//                        VerticalScrolViewLayout sView = new VerticalScrolViewLayout () {
//                            Height = Application.GetRealHeight (844),
//                        };
//                        AddChidren (sView);
//                        #region title
//                        RowLayout frameLayout = new RowLayout () {
//                            Height = Application.GetRealHeight (100),
//                            Width = LayoutParams.MatchParent,
//                            BackgroundColor = SkinStyle.Current.MainColor
//                        };
//                        sView.AddChidren (frameLayout);
 
//                        Button backButton = new Button () {
//                            Height = Application.GetRealHeight (90),
//                            Width = Application.GetRealWidth (85),
//                            UnSelectedImagePath = "Item/Back.png",
//                            SelectedImagePath = "Item/BackSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        backButton.MouseUpEventHandler += (sender, e) => {
//                            (Parent as PageLayout).PageIndex -= 1;
//                            //SystemMiddle.ShowGateWayView ();
//                        };
//                        frameLayout.AddChidren (backButton);
//                        string strOnePortWirelessFRRemark = gatewayDevice.Name.ToString ();
//                        EditText textButton = new EditText () {
//                            X = Application.GetRealWidth (11) + backButton.Right,
//                            Height = Application.GetRealHeight (50),
//                            Width = Application.GetRealWidth (370),
//                            Text = strOnePortWirelessFRRemark,
//                            Gravity = Gravity.CenterVertical,
//                            Enable = false,
//                            BackgroundColor = SkinStyle.Current.Transparent,
//                            SelectedBackgroundColor = SkinStyle.Current.SysEditBox,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout.AddChidren (textButton);
 
//                        Button editor = new Button () {
//                            Height = Application.GetRealHeight (90),
//                            Width = Application.GetRealWidth (70),
//                            UnSelectedImagePath = "Item/Editor.png",
//                            SelectedImagePath = "Item/EditorSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        editor.X = frameLayout.Width - editor.Width - Application.GetRealWidth (120);
//                        frameLayout.AddChidren (editor);
//                        editor.MouseUpEventHandler += (sender, e) => {//---------------修改Remark----------------
//                            if (editor.IsSelected == true) {
//                                MainPage.Loading.Start ();
//                                gatewayDevice.Name = textButton.Text.Trim ();
//                                UpdateBaseInfo (gatewayDevice);
//                                editor.IsSelected = false;
//                                textButton.Enable = false;
//                                textButton.IsSelected = false;
//                                MainPage.Loading.Hide ();
//                            } else {
//                                textButton.Enable = textButton.IsSelected = editor.IsSelected = true;
//                            }
//                        };
 
//                        Button gatewayInfoSwitch = new Button () {
//                            Height = Application.GetRealHeight (90),
//                            Width = Application.GetRealWidth (90),
//                            UnSelectedImagePath = "Item/GatwayInfoHide.png",
//                            SelectedImagePath = "Item/GatwayInfoShow.png",
//                            Gravity = Gravity.CenterVertical,
//                            X = editor.Right + Application.GetRealWidth (5)
//                        };
//                        frameLayout.AddChidren (gatewayInfoSwitch);
//                        #endregion
//                        VerticalScrolViewLayout HideInfoView = new VerticalScrolViewLayout () {
//                            Height = 0,
//                        };
//                        sView.AddChidren (HideInfoView);
 
//                        #region GatewayID
//                        RowLayout frameLayoutGatewayID = new RowLayout () {
//                            Height = Application.GetRealHeight (98),
//                            Width = LayoutParams.MatchParent,
//                            BackgroundColor = SkinStyle.Current.MainColor
//                        };
//                        HideInfoView.AddChidren (frameLayoutGatewayID);
 
//                        Button gatewayIDText = new Button () {
//                            X = Application.GetRealWidth (15),
//                            Height = Application.GetRealHeight (66),
//                            Width = Application.GetRealWidth (66),
//                            UnSelectedImagePath = "Item/OnePort.png",
//                            SelectedImagePath = "Item/OnePortSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        frameLayoutGatewayID.AddChidren (gatewayIDText);
//                        Button gatewayIDName = new Button () {
//                            X = backButton.Right,
//                            Height = Application.GetRealHeight (41),
//                            Width = Application.GetRealWidth (150),
//                            TextID = R.MyInternationalizationString.GatewayID,
//                            Gravity = Gravity.CenterVertical,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayoutGatewayID.AddChidren (gatewayIDName);
//                        EditText etGatewayID = new EditText () {
//                            Height = Application.GetRealHeight (52),
//                            Width = Application.GetRealWidth (62),
//                            X = gatewayIDName.Right,
//                            Gravity = Gravity.CenterVertical,
//                            TextAlignment = TextAlignment.Center,
//                            Text = gatewayDevice.SubnetID.ToString (),
//                            SelectedBackgroundColor = SkinStyle.Current.SysEditBox,
//                            BackgroundColor = SkinStyle.Current.Transparent,
//                            Enable = false,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayoutGatewayID.AddChidren (etGatewayID);
 
//                        Button gatewayIDEdit = new Button () {
//                            Height = Application.GetRealHeight (90),
//                            Width = Application.GetRealWidth (70),
//                            UnSelectedImagePath = "Item/Editor.png",
//                            SelectedImagePath = "Item/EditorSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        gatewayIDEdit.X = frameLayout.Width - gatewayIDEdit.Width - Application.GetRealWidth (30);
//                        #region 更改网关设备号
 
//                        gatewayIDEdit.MouseUpEventHandler += (sender, e) => {
//                            string [] macAddress = gatewayDevice.MAC.Split ('.');
//                            if (etGatewayID.Enable) {
//                                gatewayIDEdit.IsSelected = etGatewayID.Enable = etGatewayID.IsSelected = false;
//                                byte [] Musics = new byte [10];
//                                for (int i = 0; i < macAddress.Length; i++) {
//                                    Musics [i] = Convert.ToByte (macAddress [i], 16);
//                                }
//                                try {
//                                    Musics [8] = Convert.ToByte (Convert.ToInt32 (etGatewayID.Text.Trim ()));
//                                    if (Musics [8] < 0 || Musics [8] > 255) {
//                                        throw new Exception ();
//                                    }
//                                } catch {
//                                    new Alert ("", Language.StringByID (R.MyInternationalizationString.TipPleaseEnterTheCorrectData), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                    return;
//                                }
//                                Control.ControlBytesSend (Command.SetDeviceSubnetID, gatewayDevice.SubnetID, gatewayDevice.DeviceID, Musics);
//                                foreach (string ss in IO.FileUtils.ReadFiles ()) {
//                                    if (ss.Contains ("Equipment_")) {
//                                        if (ss.Contains ("_" + Musics [8].ToString () + "_") || ss.Contains ("_" + gatewayDevice.SubnetID.ToString () + "_")) {
//                                            IO.FileUtils.DeleteFile (ss);
//                                        }
//                                    }
//                                }
//                                gatewayDevice.SubnetID = Musics [8];
//                                UpdateBaseInfo (gatewayDevice);
//                            } else {
//                                gatewayIDEdit.IsSelected = etGatewayID.IsSelected = etGatewayID.Enable = true;
//                            }
//                        };
//                        #endregion
//                        frameLayoutGatewayID.AddChidren (gatewayIDEdit);
//                        #endregion
 
//                        #region--------------NetWork--------------------------
//                        RowLayout flNewWorkTop = new RowLayout () {
//                            Height = Application.GetRealHeight (98),
//                            Width = LayoutParams.MatchParent,
//                            BackgroundColor = SkinStyle.Current.MainColor
//                        };
//                        HideInfoView.AddChidren (flNewWorkTop);
 
//                        Button netParameterSeleted = new Button () {
//                            X = Application.GetRealWidth (15),
//                            Height = Application.GetRealHeight (66),
//                            Width = Application.GetRealWidth (66),
//                            UnSelectedImagePath = "Item/NetParameter.png",
//                            SelectedImagePath = "Item/NetParameterSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        flNewWorkTop.AddChidren (netParameterSeleted);
//                        Button textButton1 = new Button () {
//                            X = backButton.Right,
//                            Height = Application.GetRealHeight (41),
//                            Width = Application.GetRealWidth (300),
//                            TextID = R.MyInternationalizationString.NetwordParameters,
//                            Gravity = Gravity.CenterVertical,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flNewWorkTop.AddChidren (textButton1);
//                        Button btnNetWorkHelp = new Button () {
//                            Height = Application.GetMinRealAverage (100),
//                            Width = Application.GetMinRealAverage (76),
//                            UnSelectedImagePath = "Item/Help.png",
//                            SelectedImagePath = "Item/HelpSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        btnNetWorkHelp.X = frameLayout.Width - btnNetWorkHelp.Width - Application.GetRealWidth (30);
//                        btnNetWorkHelp.MouseUpEventHandler += (sender, e) => {
//                            new Tip () { MaxWidth = 150, Text = Language.StringByID (R.MyInternationalizationString.HelpNetWork), Direction = AMPopTipDirection.Down, CloseTime = 4 }.Show ((View)sender);
//                        };
//                        flNewWorkTop.AddChidren (btnNetWorkHelp);
 
//                        //---------------------------------------------------------------------------------------------------------------------------------
//                        RowLayout frameLayout2 = new RowLayout () {
//                            Height = Application.GetRealHeight (798),
//                            Width = LayoutParams.MatchParent,
//                        };
//                        HideInfoView.AddChidren (frameLayout2);
//                        Button btnDHCP = new Button () {
//                            X = Application.GetRealWidth (100),
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (40),
//                            Width = Application.GetRealWidth (360),
//                            Text = "DHCP:",
//                            Y = Application.GetRealHeight (20),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (btnDHCP);
//                        Button btnDHCPCheck = new Button () {
//                            X = Application.GetRealWidth (640 - 176),
//                            Height = Application.GetMinRealAverage (98),
//                            Width = Application.GetMinRealAverage (76),
//                            UnSelectedImagePath = "Item/Check.png",
//                            SelectedImagePath = "Item/CheckSelected.png",
//                            Y = Application.GetRealHeight (20),
//                            IsSelected = gatewayDevice.DHCP,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (btnDHCPCheck);
 
//                        Button lblIPAddresses = new Button () {
//                            X = Application.GetRealWidth (100),
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (239),
//                            TextID = R.MyInternationalizationString.IPAddresses,
//                            Y = btnDHCP.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (lblIPAddresses);
 
//                        EditText etIPAddresses = new EditText () {
//                            X = btnDHCP.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            Text = " " + gatewayDevice.IPAddress,
//                            BackgroundColor = SkinStyle.Current.SysEditBox,
//                            Y = lblIPAddresses.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (etIPAddresses);
//                        CommonPage.FindGatewayChilrenIPAddress = gatewayDevice.IPAddress;
 
//                        Button lblSubnetMask = new Button () {
//                            X = btnDHCP.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            TextID = R.MyInternationalizationString.SubnetMask,
//                            Y = etIPAddresses.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (lblSubnetMask);
 
//                        EditText etSubnetMask = new EditText () {
//                            X = btnDHCP.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            Text = " " + gatewayDevice.SubnetMask,
//                            BackgroundColor = SkinStyle.Current.SysEditBox,
//                            Y = lblSubnetMask.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (etSubnetMask);
 
//                        Button lblRoutingIP = new Button () {
//                            X = btnDHCP.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            TextID = R.MyInternationalizationString.RoutingIP,
//                            Y = etSubnetMask.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (lblRoutingIP);
 
//                        EditText etRoutingIP = new EditText () {
//                            X = btnDHCP.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            Text = " " + gatewayDevice.RouteIPAddress,
//                            BackgroundColor = SkinStyle.Current.SysEditBox,
//                            Y = lblRoutingIP.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (etRoutingIP);
 
 
//                        Button btnDHCPSave = new Button () {
//                            X = (Application.CurrentWidth / 2 - 30),
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (100),
//                            BackgroundColor = SkinStyle.Current.ButtonColor,
//                            SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            BorderColor = SkinStyle.Current.Transparent,
//                            TextID = R.MyInternationalizationString.SAVE,
//                            Y = etRoutingIP.Bottom + Application.GetRealHeight (10),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        frameLayout2.AddChidren (btnDHCPSave);
//                        frameLayout2.Height = btnDHCPSave.Bottom + Application.GetRealHeight (20);
 
//                        btnDHCPCheck.MouseUpEventHandler += (sender, e) => {
//                            if (btnDHCPCheck.IsSelected) {
//                                btnDHCPCheck.IsSelected = false;
//                                etIPAddresses.Enable = etSubnetMask.Enable = etRoutingIP.Enable = true;
//                                btnDHCPSave.Visible = true;
//                            } else {
//                                btnDHCPCheck.IsSelected = true;
//                                etIPAddresses.Enable = etSubnetMask.Enable = etRoutingIP.Enable = false;
//                                btnDHCPSave.Visible = false;
//                            }
//                            gatewayDevice.IPAddress = etIPAddresses.Text.Trim ();
//                            gatewayDevice.SubnetMask = etSubnetMask.Text.Trim ();
//                            gatewayDevice.RouteIPAddress = etRoutingIP.Text.Trim ();
//                            gatewayDevice.DHCP = btnDHCPCheck.IsSelected;
//                            try {
//                                byte [] bytes = new byte [21];
//                                bytes [20] = gatewayDevice.DHCP == true ? (byte)1 : (byte)0;
//                                System.Net.IPAddress address;
//                                if (System.Net.IPAddress.TryParse (gatewayDevice.IPAddress, out address)) {
//                                    string [] ipAddress = gatewayDevice.IPAddress.Split ('.');
//                                    for (int i = 0; i < ipAddress.Length; i++) {
//                                        bytes [i] = byte.Parse (ipAddress [i]);
//                                    }
//                                } else {
//                                    throw new Exception ();
//                                }
 
//                                if (System.Net.IPAddress.TryParse (gatewayDevice.RouteIPAddress, out address)) {
//                                    string [] r = gatewayDevice.RouteIPAddress.Split ('.');
//                                    for (int i = 0; i < r.Length; i++) {
//                                        bytes [i + 4] = byte.Parse (r [i]);
//                                    }
//                                } else {
//                                    throw new Exception ();
//                                }
//                                string [] ipMac = gatewayDevice.IPMAC.Split ('.');
//                                //ipMAC前三位HDL  需要特殊处理
//                                bytes [0 + 8] = (byte)(ipMac [0].ToCharArray () [0]);
//                                bytes [1 + 8] = (byte)(ipMac [1].ToCharArray () [0]);
//                                bytes [2 + 8] = (byte)(ipMac [2].ToCharArray () [0]);
//                                bytes [3 + 8] = byte.Parse (ipMac [3]);
//                                bytes [4 + 8] = byte.Parse (ipMac [4]);
//                                bytes [5 + 8] = byte.Parse (ipMac [5]);
//                                string [] subnetMask = gatewayDevice.SubnetMask.Split ('.');
//                                bytes [14] = 0x17;
//                                bytes [15] = 0x70;
//                                for (int i = 0; i < subnetMask.Length; i++) {
//                                    bytes [i + 16] = byte.Parse (subnetMask [i]);
//                                }
//                                if (Control.ControlBytesSendHasReturn (Command.UpdateGatewayIp,gatewayDevice.SubnetID, gatewayDevice.DeviceID, bytes) != null) {
//                                    IO.FileUtils.SaveEquipmentMessage (gatewayDevice);
//                                }
//                                //UpdateBaseInfo (gatewayDevice);
//                            } catch {
//                                new Alert ("", Language.StringByID (R.MyInternationalizationString.TipPleaseEnterTheCorrectData), Language.StringByID (R.MyInternationalizationString.Confrim)).Show ();
//                            }
//                        };
//                        btnDHCPSave.MouseUpEventHandler += (sender, e) => {
//                            gatewayDevice.IPAddress = etIPAddresses.Text.Trim ();
//                            gatewayDevice.SubnetMask = etSubnetMask.Text.Trim ();
//                            gatewayDevice.RouteIPAddress = etRoutingIP.Text.Trim ();
//                            gatewayDevice.DHCP = btnDHCPCheck.IsSelected;
//                            try {
//                                byte [] bytes = new byte [21];
//                                bytes [20] = gatewayDevice.DHCP == true ? (byte)1 : (byte)0;
//                                System.Net.IPAddress address;
//                                if (System.Net.IPAddress.TryParse (gatewayDevice.IPAddress, out address)) {
//                                    string [] ipAddress = gatewayDevice.IPAddress.Split ('.');
//                                    for (int i = 0; i < ipAddress.Length; i++) {
//                                        bytes [i] = byte.Parse (ipAddress [i]);
//                                    }
//                                } else {
//                                    throw new Exception ();
//                                }
//                                if (System.Net.IPAddress.TryParse (gatewayDevice.RouteIPAddress, out address)) {
//                                    string [] r = gatewayDevice.RouteIPAddress.Split ('.');
//                                    for (int i = 0; i < r.Length; i++) {
//                                        bytes [i + 4] = byte.Parse (r [i]);
//                                    }
//                                } else {
//                                    throw new Exception ();
//                                }
//                                string [] ipMac = gatewayDevice.IPMAC.Split ('.');
//                                //ipMAC前三位HDL  需要特殊处理
//                                bytes [0 + 8] = (byte)(ipMac [0].ToCharArray () [0]);
//                                bytes [1 + 8] = (byte)(ipMac [1].ToCharArray () [0]);
//                                bytes [2 + 8] = (byte)(ipMac [2].ToCharArray () [0]);
//                                bytes [3 + 8] = byte.Parse (ipMac [3]);
//                                bytes [4 + 8] = byte.Parse (ipMac [4]);
//                                bytes [5 + 8] = byte.Parse (ipMac [5]);
//                                string [] subnetMask = gatewayDevice.SubnetMask.Split ('.');
//                                bytes [14] = 0x17;
//                                bytes [15] = 0x70;
//                                for (int i = 0; i < subnetMask.Length; i++) {
//                                    bytes [i + 16] = byte.Parse (subnetMask [i]);
//                                }
//                                if (Control.ControlBytesSendHasReturn (Command.UpdateGatewayIp,
//                                                                       gatewayDevice.SubnetID, gatewayDevice.DeviceID, bytes) != null) {
//                                    IO.FileUtils.SaveEquipmentMessage (gatewayDevice);
//                                }
//                                //UpdateBaseInfo (gatewayDevice);
//                            } catch {
//                                new Alert ("", Language.StringByID (R.MyInternationalizationString.TipPleaseEnterTheCorrectData), Language.StringByID (R.MyInternationalizationString.Confrim)).Show ();
//                            }
//                        };
//                        if (gatewayDevice.DHCP) {
//                            btnDHCPCheck.IsSelected = true;
//                            etIPAddresses.Enable = etSubnetMask.Enable = etRoutingIP.Enable = false;
//                            btnDHCPSave.Visible = false;
//                        } else {
//                            btnDHCPCheck.IsSelected = false;
//                            etIPAddresses.Enable = etSubnetMask.Enable = etRoutingIP.Enable = true;
//                            btnDHCPSave.Visible = true;
//                        }
//                        #endregion
 
 
//                        #region--------------RemoteAccess---------------------
//                        RowLayout flRemoteAccessTop = new RowLayout () {
//                            Height = Application.GetRealHeight (100),
//                            Width = LayoutParams.MatchParent,
//                            BackgroundColor = SkinStyle.Current.MainColor
//                        };
//                        HideInfoView.AddChidren (flRemoteAccessTop);
 
//                        Button RemoteAccessSeleted = new Button () {
//                            X = Application.GetRealWidth (15),
//                            Height = Application.GetRealHeight (66),
//                            Width = Application.GetRealWidth (66),
//                            UnSelectedImagePath = "Item/RemoteAccess.png",
//                            SelectedImagePath = "Item/RemoteAccessSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        flRemoteAccessTop.AddChidren (RemoteAccessSeleted);
//                        Button lblRemoteAccesss = new Button () {
//                            X = Application.GetRealWidth (11) + RemoteAccessSeleted.Right,
//                            Height = Application.GetRealHeight (41),
//                            Width = Application.GetRealWidth (200),
//                            TextID = R.MyInternationalizationString.RemoteAccess,
//                            Gravity = Gravity.CenterVertical,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessTop.AddChidren (lblRemoteAccesss);
//                        Button btnRemoteAccessHelp = new Button () {
//                            Height = Application.GetMinRealAverage (98),
//                            Width = Application.GetMinRealAverage (76),
//                            UnSelectedImagePath = "Item/Help.png",
//                            SelectedImagePath = "Item/HelpSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        btnRemoteAccessHelp.X = flRemoteAccessTop.Width - btnRemoteAccessHelp.Width - Application.GetRealWidth (30);
//                        flRemoteAccessTop.AddChidren (btnRemoteAccessHelp);
//                        Button btnRemoteAccessCheck = new Button () {
//                            Height = Application.GetMinRealAverage (98),
//                            Width = Application.GetMinRealAverage (76),
//                            UnSelectedImagePath = "Item/Check.png",
//                            SelectedImagePath = "Item/CheckSelected.png",
//                            Y = btnRemoteAccessHelp.Y,
//                        };
//                        btnRemoteAccessCheck.X = flRemoteAccessTop.Width - btnRemoteAccessCheck.Width - Application.GetRealWidth (100);
//                        btnRemoteAccessHelp.MouseUpEventHandler += (sender, e) => {
//                            new Tip () { MaxWidth = 150, Text = Language.StringByID (R.MyInternationalizationString.HelpRemoteAccess), Direction = AMPopTipDirection.Down, CloseTime = 4 }.Show ((View)sender);
//                        };
//                        flRemoteAccessTop.AddChidren (btnRemoteAccessCheck);
 
//                        FrameLayout flRemoteAccessBody = new FrameLayout () {
//                            Height = Application.GetRealHeight (0),
//                            Width = LayoutParams.MatchParent,
//                        };
//                        HideInfoView.AddChidren (flRemoteAccessBody);
 
//                        FrameLayout flRemoteAutoSetting = new FrameLayout () {
//                            Height = Application.GetRealHeight (90),
//                        };
//                        flRemoteAccessBody.AddChidren (flRemoteAutoSetting);
 
 
 
//                        Button btnRemoteAutoCheck = new Button () {
//                            Gravity = Gravity.Center,
//                            Width = Application.GetRealWidth (300),
//                            Height = Application.GetRealHeight (60),
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            TextColor = SkinStyle.Current.TextColor1,
//                            SelectedTextColor = SkinStyle.Current.TextColor1,
//                            TextID = R.MyInternationalizationString.AutomaticSetting,
//                            TextAlignment = TextAlignment.Center,
//                            //Text = "YES"
//                        };
//                        flRemoteAutoSetting.AddChidren (btnRemoteAutoCheck);
 
 
//                        Button btnGroupName = new Button () {
//                            X = gatewayIDName.X,
//                            Y = flRemoteAutoSetting.Bottom + Application.GetRealHeight (20),
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (49),
//                            Width = Application.GetRealWidth (360),
//                            TextID = R.MyInternationalizationString.GroupName,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (btnGroupName);
 
//                        EditText etGroupName = new EditText () {
//                            X = gatewayIDName.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            Y = btnGroupName.Bottom + Application.GetRealHeight (2),
//                            //BackgroundColor = SkinStyle.Current.SysEditBox,
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (etGroupName);
 
//                        Button lblProjectName = new Button () {
//                            X = gatewayIDName.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (40),
//                            Width = Application.GetRealWidth (360),
//                            TextID = R.MyInternationalizationString.ProjectName,
//                            Y = etGroupName.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (lblProjectName);
 
//                        EditText etProjectName = new EditText () {
//                            X = gatewayIDName.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            Y = lblProjectName.Bottom + Application.GetRealHeight (2),
//                            //BackgroundColor = SkinStyle.Current.SysEditBox,
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (etProjectName);
 
//                        Button lblUsername = new Button () {
//                            X = lblProjectName.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            TextID = R.MyInternationalizationString.UserName,
//                            Y = etProjectName.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (lblUsername);
 
//                        EditText etUserName = new EditText () {
//                            X = lblProjectName.X,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            //BackgroundColor = SkinStyle.Current.SysEditBox,
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            Y = lblUsername.Bottom + Application.GetRealHeight (2),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (etUserName);
 
//                        Button btnGatewayPassword = new Button () {
//                            X = lblProjectName.X,
//                            Y = etUserName.Bottom + Application.GetRealHeight (2),
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            TextID = R.MyInternationalizationString.PassWrod,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (btnGatewayPassword);
 
//                        EditText etGatewayPassWrod = new EditText () {
//                            X = lblProjectName.X,
//                            Y = btnGatewayPassword.Bottom + Application.GetRealHeight (2),
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            Text = gatewayDevice.Remote_Password,
//                            //BackgroundColor = SkinStyle.Current.SysEditBox,
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (etGatewayPassWrod);
 
//                        Button btnServerIP = new Button () {
//                            X = lblProjectName.X,
//                            Y = etGatewayPassWrod.Bottom + Application.GetRealHeight (2),
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            TextID = R.MyInternationalizationString.ServerIP,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (btnServerIP);
 
//                        EditText etServerIP = new EditText () {
//                            X = lblProjectName.X,
//                            Y = btnServerIP.Bottom + Application.GetRealHeight (2),
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (300),
//                            //BackgroundColor = SkinStyle.Current.SysEditBox,
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (etServerIP);
 
//                        EditText etServerIPPoint = new EditText () {
//                            X = etServerIP.Right + 2,
//                            Y = etServerIP.Y,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (140) - 2,
//                            //BackgroundColor = SkinStyle.Current.SysEditBox,
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (etServerIPPoint);
 
//                        Button btnAlternativeServerIP = new Button () {
//                            X = lblProjectName.X,
//                            Y = etServerIP.Bottom + Application.GetRealHeight (2),
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (440),
//                            TextID = R.MyInternationalizationString.AlternativeServerIP,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (btnAlternativeServerIP);
 
//                        EditText etAlternativeServerIP = new EditText () {
//                            X = lblProjectName.X,
//                            Y = btnAlternativeServerIP.Bottom + Application.GetRealHeight (2),
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (300),
//                            //BackgroundColor = SkinStyle.Current.SysEditBox,
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (etAlternativeServerIP);
//                        EditText etAlternativeServerIPPoint = new EditText () {
//                            X = etAlternativeServerIP.Right + 2,
//                            Y = etAlternativeServerIP.Y,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (140) - 2,
//                            //BackgroundColor = SkinStyle.Current.SysEditBox,
//                            BorderColor = SkinStyle.Current.BorderColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (etAlternativeServerIPPoint);
 
//                        Button btnGatewaySave = new Button () {
//                            X = (Application.CurrentWidth / 2 - 30),
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (100),
//                            BackgroundColor = SkinStyle.Current.ButtonColor,
//                            SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
//                            BorderWidth = 1,
//                            Radius = 5,
//                            BorderColor = SkinStyle.Current.Transparent,
//                            TextID = R.MyInternationalizationString.SAVE,
//                            Y = etAlternativeServerIP.Bottom + Application.GetRealHeight (20),
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flRemoteAccessBody.AddChidren (btnGatewaySave);
//                        flRemoteAccessBody.Height = btnGatewaySave.Bottom + Application.GetRealHeight (20);
//                        byte [] gatewayBytes = null;
//                        byte [] serverIPBytes = null;
//                        System.Threading.Tasks.Task.Run (() => {
//                            gatewayBytes = Control.ControlBytesSendHasReturn (Command.ReadGateWayModelInfo, gatewayDevice.SubnetID, gatewayDevice.DeviceID, new byte [] { });
//                            serverIPBytes = Control.ControlBytesSendHasReturn (Command.ReadGatewayServerIP, gatewayDevice.SubnetID, gatewayDevice.DeviceID, new byte [] { });
//                            IO.FileUtils.WriteFileByBytes ("Remote_GatewayBytes_" + gatewayDevice.Name + "_" + gatewayDevice.SubnetID, gatewayBytes);
//                            if (gatewayBytes != null && serverIPBytes != null) {
//                                Application.RunOnMainThread (() => {
//                                    #region ---读取、设置组名工程名---
//                                    int model = gatewayBytes [0];
//                                    gatewayDevice.Remote_GroupName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 1, 20).Trim ('\0');
//                                    gatewayDevice.Remote_ProjectName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 21, 20).Trim ('\0');
//                                    gatewayDevice.Remote_UserName = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 41, 8).Trim ('\0');
//                                    gatewayDevice.Remote_Password = CommonPage.MyEncodingGB2312.GetString (gatewayBytes, 49, 8).Trim ('\0');
//                                    IO.FileUtils.SaveEquipmentMessage (gatewayDevice);
 
//                                    etGroupName.Text = gatewayDevice.Remote_GroupName;
//                                    etProjectName.Text = gatewayDevice.Remote_ProjectName;
//                                    etUserName.Text = gatewayDevice.Remote_UserName;
//                                    etGatewayPassWrod.Text = gatewayDevice.Remote_Password;
 
//                                    btnRemoteAccessCheck.MouseUpEventHandler += (sender, e) => {
//                                        if (!btnRemoteAccessCheck.IsSelected) {
//                                            flRemoteAccessBody.Height = btnGatewaySave.Bottom + Application.GetRealHeight (20);
//                                            btnRemoteAccessCheck.IsSelected = true;
//                                            gatewayDevice.RometoMode = gatewayBytes [0] = 2;
//                                            Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDevice.SubnetID, gatewayDevice.DeviceID, gatewayBytes);
//                                            UserConfig.Instance.RemoteModeFile = "Equipment_" + gatewayDevice.Type.ToString () + "_" + gatewayDevice.SubnetID.ToString () + "_" + gatewayDevice.DeviceID.ToString ();
//                                            UserConfig.Instance.SaveUserConfig ();
//                                        } else {
//                                            flRemoteAccessBody.Height = Application.GetRealHeight (0);
//                                            btnRemoteAccessCheck.IsSelected = false;
//                                            gatewayDevice.RometoMode = gatewayBytes [0] = 0;
//                                            Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDevice.SubnetID, gatewayDevice.DeviceID, gatewayBytes);
//                                            UserConfig.Instance.RemoteModeFile = "";
//                                            UserConfig.Instance.SaveUserConfig ();
//                                        }
//                                        IO.FileUtils.SaveEquipmentMessage (gatewayDevice);
//                                    };
//                                    #endregion
//                                    #region ---读取、设置 网关IP地址参数---
//                                    string serverIP1 = serverIPBytes [0].ToString () + "." + serverIPBytes [1].ToString () + "." +
//                                        serverIPBytes [2].ToString () + "." + serverIPBytes [3].ToString ();
//                                    string serverIP1Point = ((serverIPBytes [4] * 256) + serverIPBytes [5]).ToString ();
//                                    string serverIP2 = serverIPBytes [6].ToString () + "." + serverIPBytes [7].ToString () + "." +
//                                        serverIPBytes [8].ToString () + "." + serverIPBytes [9].ToString ();
//                                    string serverIP2Point = ((serverIPBytes [10] * 256) + serverIPBytes [11]).ToString ();
//                                    etServerIP.Text = serverIP1;
//                                    etServerIPPoint.Text = serverIP1Point == "0" ? "9999" : serverIP1Point;
//                                    serverIP1Point = etServerIPPoint.Text;
//                                    etAlternativeServerIP.Text = serverIP2;
//                                    etAlternativeServerIPPoint.Text = serverIP2Point == "0" ? "9999" : serverIP2Point;
//                                    serverIP2Point = etAlternativeServerIPPoint.Text;
//                                    btnGatewaySave.MouseUpEventHandler += (sender, e) => {
//                                        gatewayDevice.Remote_GroupName = etGroupName.Text.Trim ();// "james";//gatewayGroupName;
//                                        gatewayDevice.Remote_ProjectName = etProjectName.Text.Trim ();//"myhome";//gatewayProjectName;
//                                        gatewayDevice.Remote_UserName = etUserName.Text.Trim ();//"james";//gatewayUserName;
//                                        gatewayDevice.Remote_Password = etGatewayPassWrod.Text.Trim ();//"chy1125";//gatewayPassWord;
 
//                                        string [] strServerIP = etServerIP.Text.Split ('.');
//                                        string [] strServerIP1 = etAlternativeServerIP.Text.Split ('.');
//                                        IO.FileUtils.SaveEquipmentMessage (gatewayDevice);
//                                        System.Threading.Tasks.Task.Run (() => {
//                                            try {
//                                                Application.RunOnMainThread (() => {
//                                                    MainPage.Loading.Start ("Sending...");
//                                                });
//                                                byte [] ggn = new byte [20];
//                                                byte [] b1 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDevice.Remote_GroupName);
//                                                Array.Copy (b1, 0, ggn, 0, 20 < b1.Length ? 20 : b1.Length);
 
//                                                byte [] gpn = new byte [20];
//                                                byte [] b2 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDevice.Remote_ProjectName);
//                                                Array.Copy (b2, 0, gpn, 0, 20 < b2.Length ? 20 : b2.Length);
 
//                                                byte [] gun = new byte [8];
//                                                byte [] b3 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDevice.Remote_UserName);
//                                                Array.Copy (b3, 0, gun, 0, 8 < b3.Length ? 8 : b3.Length);
 
//                                                byte [] gpw = new byte [8];
//                                                byte [] b4 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDevice.Remote_Password);
//                                                Array.Copy (b4, 0, gpw, 0, 8 < b4.Length ? 8 : b4.Length);
 
 
//                                                byte [] macAddress = Control.ControlBytesSendHasReturn (Command.ReadDeviceMac, gatewayDevice.SubnetID, gatewayDevice.DeviceID, new byte [] { });
//                                                byte [] sendServerBytes = new byte [56];
//                                                Array.Copy (gpn, 0, sendServerBytes, 0, 20 < gpn.Length ? 20 : gpn.Length);
//                                                Array.Copy (ggn, 0, sendServerBytes, 20, 20 < ggn.Length ? 20 : ggn.Length);
//                                                Array.Copy (gun, 0, sendServerBytes, 40, 8 < gun.Length ? 8 : gun.Length);
//                                                Array.Copy (macAddress, 0, sendServerBytes, 48, 8 < macAddress.Length ? 8 : macAddress.Length);
//                                                //Control control = new Control ();
//                                                //control.Send (new Target () {
//                                                //    IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (MainPage.SeviceIP), 9999),
//                                                //    Command = Command.SendRemoteInfoToServer,
//                                                //    SubnetID = 251,
//                                                //    DeviceID = 251,
//                                                //    AddData = sendServerBytes,
//                                                //}, SendCount.Three, true);
//                                                //var serverResult = control.UsefulBytes;
//                                                //if (serverResult == null || serverResult [0] == 0) {
//                                                //    Application.RunOnMainThread (() => {
//                                                //        new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed),
//                                                //                   Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                                //    });
//                                                //    //} else if (serverResult [0] == 2) {
//                                                //    //Application.RunOnMainThread (() => {
//                                                //    //    new Alert ("", Language.StringByID (R.MyInternationalizationString.HaveTheSame),
//                                                //    //               Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                                //    //});
//                                                //} else {
//                                                    Array.Copy (ggn, 0, gatewayBytes, 1, 20 < ggn.Length ? 20 : ggn.Length);
//                                                    Array.Copy (gpn, 0, gatewayBytes, 21, 20 < gpn.Length ? 20 : gpn.Length);
//                                                    Array.Copy (gun, 0, gatewayBytes, 41, 8 < gun.Length ? 8 : gun.Length);
//                                                    Array.Copy (gpw, 0, gatewayBytes, 49, 8 < gpw.Length ? 8 : gpw.Length);
 
//                                                    Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDevice.SubnetID, gatewayDevice.DeviceID, gatewayBytes);
 
//                                                    if (strServerIP.Length != 4 || strServerIP1.Length != 4) {
//                                                        throw new Exception ();
//                                                    } else {
//                                                        serverIPBytes [0] = Convert.ToByte (strServerIP [0]);
//                                                        serverIPBytes [1] = Convert.ToByte (strServerIP [1]);
//                                                        serverIPBytes [2] = Convert.ToByte (strServerIP [2]);
//                                                        serverIPBytes [3] = Convert.ToByte (strServerIP [3]);
//                                                        int point1 = 9999;
//                                                        if (!int.TryParse (serverIP1Point, out point1)) {
//                                                            point1 = 9999;
//                                                        }
//                                                        serverIPBytes [4] = Convert.ToByte (point1 / 256);
//                                                        serverIPBytes [5] = Convert.ToByte (point1 % 256);
 
//                                                        serverIPBytes [6] = Convert.ToByte (strServerIP1 [0]);
//                                                        serverIPBytes [7] = Convert.ToByte (strServerIP1 [1]);
//                                                        serverIPBytes [8] = Convert.ToByte (strServerIP1 [2]);
//                                                        serverIPBytes [9] = Convert.ToByte (strServerIP1 [3]); int point2 = 9999;
//                                                        if (!int.TryParse (serverIP2Point, out point2)) {
//                                                            point2 = 9999;
//                                                        }
//                                                        serverIPBytes [10] = Convert.ToByte (point2 / 256);
//                                                        serverIPBytes [11] = Convert.ToByte (point2 % 256);
//                                                    }
//                                                    //远程ip地址的设置
//                                                    var mobytes = Control.ControlBytesSendHasReturn (Command.SetGateWayModelInternetInfo, gatewayDevice.SubnetID, gatewayDevice.DeviceID, serverIPBytes);
//                                                    if (mobytes == null || mobytes [0] == 0xF5) {
//                                                        Application.RunOnMainThread (() => {
//                                                            new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed),
//                                                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                                        });
//                                                    } else {
//                                                        Application.RunOnMainThread (() => {
//                                                            new Alert ("", Language.StringByID (R.MyInternationalizationString.ThePerationWasSuccessful), Language.StringByID (R.MyInternationalizationString.Confrim)).Show ();
//                                                        });
//                                                    }
//                                                //}
//                                            } catch {
//                                                Application.RunOnMainThread (() => {
//                                                    new Alert ("", Language.StringByID (R.MyInternationalizationString.TipPleaseEnterTheCorrectData), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                                });
//                                            } finally {
//                                                Application.RunOnMainThread (() => {
//                                                    MainPage.Loading.Hide ();
//                                                });
//                                            }
//                                        });
//                                    };
//                                    #endregion
 
//                                    if (model == 0) {
//                                        flRemoteAccessBody.Height = Application.GetRealHeight (0);
//                                        btnRemoteAccessCheck.IsSelected = false;
//                                    } else {
//                                        flRemoteAccessBody.Height = btnGatewaySave.Bottom + Application.GetRealHeight (20);
//                                        btnRemoteAccessCheck.IsSelected = true;
//                                        UserConfig.Instance.RemoteModeFile = "Equipment_" + gatewayDevice.Type.ToString () + "_" + gatewayDevice.SubnetID.ToString () + "_" + gatewayDevice.DeviceID.ToString ();
//                                        UserConfig.Instance.SaveUserConfig ();
//                                        gatewayBytes [0] = 2;
//                                    }
//                                });
//                            }
//                        });
 
 
//                        btnRemoteAutoCheck.MouseUpEventHandler += (sender, e) => {
//                            Dialog dialogRemoteAuto = new Dialog ();
 
//                            FrameLayout remoteAutoView = new FrameLayout () {
//                                Width = Application.GetRealWidth (400),
//                                Height = Application.GetRealHeight (270 + 100),
//                                Gravity = Gravity.Center,
//                                Radius = 5,
//                                BorderColor = SkinStyle.Current.Transparent,
//                                BorderWidth = 0,
//                                BackgroundColor = SkinStyle.Current.DialogColor,
//                            };
//                            dialogRemoteAuto.AddChidren (remoteAutoView);
 
 
//                            Button remoteAutoTitle = new Button () {
//                                Height = Application.GetRealHeight (80),
//                                BackgroundColor = SkinStyle.Current.DialogTitle,
//                                TextID = R.MyInternationalizationString.RemotePassword,
//                                TextColor = SkinStyle.Current.DialogTextColor,
//                                TextAlignment = TextAlignment.Center,
//                            };
//                            remoteAutoView.AddChidren (remoteAutoTitle);
 
 
//                            EditText etRemoteAutoPW = new EditText () {
//                                Gravity = Gravity.Center,
//                                Height = Application.GetRealHeight (55),
//                                Width = Application.GetRealWidth (300),
//                                //BackgroundColor = SkinStyle.Current.SysEditBox,
//                                BorderColor = SkinStyle.Current.BorderColor,
//                                TextAlignment = TextAlignment.Center,
//                                BorderWidth = 1,
//                                Radius = 5,
//                                TextColor = SkinStyle.Current.TextColor
//                            };
//                            remoteAutoView.AddChidren (etRemoteAutoPW);
 
//                            FrameLayout remoteAutoBottom = new FrameLayout () {
//                                Y = Application.GetRealHeight (270 + 20),
//                                Height = Application.GetRealHeight (83),
//                                BackgroundColor = SkinStyle.Current.LineColor,
//                            };
//                            remoteAutoView.AddChidren (remoteAutoBottom);
 
//                            Button btnCancel = new Button () {
//                                Width = Application.GetRealWidth (200),
//                                BackgroundColor = SkinStyle.Current.DialogTitle,
//                                TextID = R.MyInternationalizationString.cancel,
//                                TextAlignment = TextAlignment.Center,
//                            };
//                            remoteAutoBottom.AddChidren (btnCancel);
//                            btnCancel.MouseUpEventHandler += (ssd, de) => {
//                                dialogRemoteAuto.Close ();
//                            };
 
//                            Button btnConfrim = new Button () {
//                                X = btnCancel.Right + 1,
//                                Width = Application.GetRealWidth (200),
//                                BackgroundColor = SkinStyle.Current.DialogTitle,
//                                TextID = R.MyInternationalizationString.Confrim,
//                                TextAlignment = TextAlignment.Center,
//                            };
//                            remoteAutoBottom.AddChidren (btnConfrim);
 
//                            btnConfrim.MouseUpEventHandler += (ssd, de) => {
//                                if (etRemoteAutoPW.Text.Trim ().Length < 6) {
//                                    new Tip () { MaxWidth = 250, Text = Language.StringByID (R.MyInternationalizationString.PasswordLenghtTip), Direction = AMPopTipDirection.Down, CloseTime = 3 }.Show (etRemoteAutoPW);
//                                    return;
//                                }
 
//                                gatewayDevice.Remote_GroupName = etGroupName.Text = UserConfig.Instance.CurrentRegion.RegionName;
//                                gatewayDevice.Remote_ProjectName = etProjectName.Text = UserConfig.Instance.CurrentRegion.RegionName;
//                                gatewayDevice.Remote_UserName = etUserName.Text = "Admin";
//                                gatewayDevice.Remote_Password = etGatewayPassWrod.Text = etRemoteAutoPW.Text.Trim ();
 
//                                string [] strServerIP = (MainPage.SeviceIP).Split ('.');
//                                string [] strServerIP1 = (MainPage.SeviceIP).Split ('.');
//                                etServerIP.Text = etAlternativeServerIP.Text = MainPage.SeviceIP;
//                                etServerIPPoint.Text = etAlternativeServerIPPoint.Text = "9999";
//                                System.Threading.Tasks.Task.Run (() => {
//                                    try {
//                                        Application.RunOnMainThread (() => {
//                                            MainPage.Loading.Start ("Sending...");
//                                        });
//                                        byte [] ggn = new byte [20];
//                                        byte [] b1 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDevice.Remote_GroupName);
//                                        Array.Copy (b1, 0, ggn, 0, 20 < b1.Length ? 20 : b1.Length);
 
//                                        byte [] gpn = new byte [20];
//                                        byte [] b2 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDevice.Remote_ProjectName);
//                                        Array.Copy (b2, 0, gpn, 0, 20 < b2.Length ? 20 : b2.Length);
 
//                                        byte [] gun = new byte [8];
//                                        byte [] b3 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDevice.Remote_UserName);
//                                        Array.Copy (b3, 0, gun, 0, 8 < b3.Length ? 8 : b3.Length);
 
//                                        byte [] gpw = new byte [8];
//                                        byte [] b4 = CommonPage.MyEncodingGB2312.GetBytes (gatewayDevice.Remote_Password);
//                                        Array.Copy (b4, 0, gpw, 0, 8 < b4.Length ? 8 : b4.Length);
 
 
//                                        byte [] macAddress = Control.ControlBytesSendHasReturn (Command.ReadDeviceMac, gatewayDevice.SubnetID, gatewayDevice.DeviceID, new byte [] { });
//                                        byte [] sendServerBytes = new byte [56];
//                                        Array.Copy (gpn, 0, sendServerBytes, 0, 20 < gpn.Length ? 20 : gpn.Length);
//                                        Array.Copy (ggn, 0, sendServerBytes, 20, 20 < ggn.Length ? 20 : ggn.Length);
//                                        Array.Copy (gun, 0, sendServerBytes, 40, 8 < gun.Length ? 8 : gun.Length);
//                                        Array.Copy (macAddress, 0, sendServerBytes, 48, 8 < macAddress.Length ? 8 : macAddress.Length);
//                                        //Control control = new Control ();
//                                        //control.Send (new Target () {
//                                        //    IPEndPoint = new System.Net.IPEndPoint (System.Net.IPAddress.Parse (MainPage.SeviceIP), 9999),
//                                        //    Command = Command.SendRemoteInfoToServer,
//                                        //    SubnetID = 251,
//                                        //    DeviceID = 251,
//                                        //    AddData = sendServerBytes,
//                                        //}, SendCount.Three, true);
//                                        //var serverResult = control.UsefulBytes;
//                                        //if (serverResult == null || serverResult [0] == 0) {
//                                        //    Application.RunOnMainThread (() => {
//                                        //        new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed),
//                                        //                   Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                        //    });
//                                        //} else {
//                                            Array.Copy (ggn, 0, gatewayBytes, 1, 20 < ggn.Length ? 20 : ggn.Length);
//                                            Array.Copy (gpn, 0, gatewayBytes, 21, 20 < gpn.Length ? 20 : gpn.Length);
//                                            Array.Copy (gun, 0, gatewayBytes, 41, 8 < gun.Length ? 8 : gun.Length);
//                                            Array.Copy (gpw, 0, gatewayBytes, 49, 8 < gpw.Length ? 8 : gpw.Length);
 
//                                            Control.ControlBytesSend (Command.SetGateWayModelInfo, gatewayDevice.SubnetID, gatewayDevice.DeviceID, gatewayBytes);
 
//                                            if (strServerIP.Length != 4 || strServerIP1.Length != 4) {
//                                                throw new Exception ();
//                                            } else {
//                                                serverIPBytes [0] = Convert.ToByte (strServerIP [0]);
//                                                serverIPBytes [1] = Convert.ToByte (strServerIP [1]);
//                                                serverIPBytes [2] = Convert.ToByte (strServerIP [2]);
//                                                serverIPBytes [3] = Convert.ToByte (strServerIP [3]);
//                                                int point1 = 9999;
 
//                                                serverIPBytes [4] = Convert.ToByte (point1 / 256);
//                                                serverIPBytes [5] = Convert.ToByte (point1 % 256);
 
//                                                serverIPBytes [6] = Convert.ToByte (strServerIP1 [0]);
//                                                serverIPBytes [7] = Convert.ToByte (strServerIP1 [1]);
//                                                serverIPBytes [8] = Convert.ToByte (strServerIP1 [2]);
//                                                serverIPBytes [9] = Convert.ToByte (strServerIP1 [3]);
//                                                int point2 = 9999;
 
//                                                serverIPBytes [10] = Convert.ToByte (point2 / 256);
//                                                serverIPBytes [11] = Convert.ToByte (point2 % 256);
//                                            }
//                                            //远程ip地址的设置
//                                            var mobytes = Control.ControlBytesSendHasReturn (Command.SetGateWayModelInternetInfo, gatewayDevice.SubnetID, gatewayDevice.DeviceID, serverIPBytes);
//                                            if (mobytes == null || mobytes [0] == 0xF5) {
//                                                Application.RunOnMainThread (() => {
//                                                    new Alert ("", Language.StringByID (R.MyInternationalizationString.OperationFailed),
//                                                               Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                                });
//                                            } else {
//                                                Application.RunOnMainThread (() => {
//                                                    new Alert ("", Language.StringByID (R.MyInternationalizationString.ThePerationWasSuccessful), Language.StringByID (R.MyInternationalizationString.Confrim)).Show ();
//                                                    IO.FileUtils.SaveEquipmentMessage (gatewayDevice);
//                                                    dialogRemoteAuto.Close ();
//                                                });
//                                            }
//                                        //}
//                                    } catch {
//                                        Application.RunOnMainThread (() => {
//                                            new Alert ("", Language.StringByID (R.MyInternationalizationString.TipPleaseEnterTheCorrectData), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
//                                        });
//                                    } finally {
//                                        Application.RunOnMainThread (() => {
//                                            MainPage.Loading.Hide ();
//                                        });
//                                    }
//                                });
//                            };
 
//                            dialogRemoteAuto.Show ();
//                        };
 
//                        #endregion
 
                    
//                        gatewayInfoSwitch.MouseUpEventHandler += (sender, e) => {
//                            gatewayInfoSwitch.IsSelected = !gatewayInfoSwitch.IsSelected;
//                            if (gatewayInfoSwitch.IsSelected) {
//                                HideInfoView.Height = flRemoteAccessBody.Bottom - frameLayoutGatewayID.X;
//                            } else {
//                                HideInfoView.Height = 0;
//                            }
//                        };
 
//                        #region ----Add a connection to the Gateway List-----
//                        RowLayout flGatewayMapping = new RowLayout () {
//                            Height = Application.GetRealHeight (100),
//                            Width = LayoutParams.MatchParent,
//                            BackgroundColor = SkinStyle.Current.MainColor
//                        };
//                        sView.AddChidren (flGatewayMapping);
//                        Button btnGatewayMappingAdd = new Button () {
//                            X = Application.GetRealWidth (17),
//                            Height = Application.GetRealHeight (55),
//                            Width = Application.GetRealWidth (55),
//                            UnSelectedImagePath = "Item/+.png",
//                            SelectedImagePath = "Item/+Selected.png",
//                            Gravity = Gravity.CenterVertical,
//                        };
//                        flGatewayMapping.AddChidren (btnGatewayMappingAdd);
 
//                        Button rpMappingAdd = new Button () {
//                            X = backButton.Right,
//                            Height = Application.GetRealHeight (41),
//                            Width = Application.GetRealWidth (400),
//                            TextID = R.MyInternationalizationString.GatewayList,
//                            Gravity = Gravity.CenterVertical,
//                            TextAlignment = TextAlignment.CenterLeft,
//                            TextColor = SkinStyle.Current.TextColor1
//                        };
//                        flGatewayMapping.AddChidren (rpMappingAdd);
//                        Button btnGatewayMappingHelp = new Button () {
//                            Height = Application.GetMinRealAverage (100),
//                            Width = Application.GetMinRealAverage (76),
//                            UnSelectedImagePath = "Item/Help.png",
//                            SelectedImagePath = "Item/HelpSelected.png",
//                            Gravity = Gravity.CenterVertical,
//                            X = btnNetWorkHelp.X,
//                        };
//                        btnGatewayMappingHelp.MouseUpEventHandler += (sender, e) => {
//                            new Tip () { MaxWidth = 150, Text = Language.StringByID (R.MyInternationalizationString.DistributionMACHelp), Direction = AMPopTipDirection.Down, CloseTime = 4 }.Show ((View)sender);
//                        };
//                        flGatewayMapping.AddChidren (btnGatewayMappingHelp);
 
//                        FrameLayout flGatewayMapping4 = new FrameLayout () {
//                            Height = Application.GetRealHeight (60),
//                            Width = LayoutParams.MatchParent,
//                        };
 
//                        EventHandler<MouseEventArgs> handler = (sender, e) => {
//                            SystemWirelessGateway.UpdataGatewayList (btnGatewayMappingHelp.X, flGatewayMapping4, gatewayDevice.SubnetID);
//                        };
//                        btnGatewayMappingAdd.MouseUpEventHandler += handler;
//                        rpMappingAdd.MouseUpEventHandler += handler;
 
//                        sView.AddChidren (flGatewayMapping4);
//                        #endregion
//                        //},true);
 
//                        // 刷新当前一端口交换机
//                        var sysBottomView = new FrameLayout () {
//                            Height = Application.GetRealHeight (90),
//                            Y = Application.GetRealHeight (844)
//                        };
//                        AddChidren (sysBottomView);
 
//                        Button AddSystemEquipmentButton = new Button () {
//                            Width = LayoutParams.MatchParent,
//                            Height = LayoutParams.MatchParent,
//                            TextID = R.MyInternationalizationString.ReFresh,
//                            TextAlignment = TextAlignment.Center,
//                            TextColor = SkinStyle.Current.TextColor1,
//                            BackgroundColor = SkinStyle.Current.MainColor
//                        };
//                        sysBottomView.AddChidren (AddSystemEquipmentButton);
//                        AddSystemEquipmentButton.MouseUpEventHandler += (sender, e) => {
//                            MainPage.Loading.Start ();
//                            System.Threading.Tasks.Task.Run (() => {
//                                CommonPage.GateWayList.Clear ();
//                                CommonPage.RandomHigh = (byte)new Random ().Next (255);
//                                CommonPage.RandomLow = (byte)new Random ().Next (255);
//                                gatewayInfo = Control.ControlBytesSendHasReturn (Command.ReadGateway, gatewayDevice.SubnetID, gatewayDevice.DeviceID, new byte [] { CommonPage.RandomHigh, CommonPage.RandomLow });
//                                var deviceBytes = IO.FileUtils.ReadEquipmentMessage (gatewayDevice);
//                                var gatewayDevice1 = Newtonsoft.Json.JsonConvert.DeserializeObject<RCU> (deviceBytes);
//                                if (gatewayDevice1 != null)
//                                    Application.RunOnMainThread (() => {
//                                        this.ShowRCU (gatewayDevice1);
//                                    });
//                            });
//                        };
//                        sysBottomView.AddChidren (new Button () { Height = 1, BackgroundColor = SkinStyle.Current.White20Transparent });
//                    }
//                });
//            });
//        }
//        /// <summary>
//        /// 弹出确认分配设备地址的窗口
//        /// </summary>
//        static void ShowAssignedAddressDialog (byte subnetID, byte deviceID)
//        {
//            SystemWirelessGateway.ShowAssignedAddressDialog (subnetID, deviceID);
//        }
//    }
//}