JLChen
2020-11-26 8905afcbd6dbb859e79199be86a7c706a03307b0
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
using System;
using System.Collections.Generic;
using System.Threading;
using HDL_ON.DAL.Server;
using HDL_ON.Entity;
using HDL_ON.UI.CSS;
using Shared;
 
namespace HDL_ON.UI.UI1Login
{
    public partial class RegisterPage : Dialog
    {
        #region 控件列表
        /// <summary>
        /// 等待提示
        /// </summary>
        Loading waitPage;
        /// <summary>
        /// 当前界面
        /// </summary>
        FrameLayout bodyView;
        /// <summary>
        /// 选择手机登录按钮
        /// </summary>
        Button btnPhoneLogin;
        /// <summary>
        /// 选择邮箱登录按钮
        /// </summary>
        Button btnEmailLogin;
        #region 服务器选择
        /// <summary>
        /// 服务器区域
        /// </summary>
        FrameLayout serverView;
        /// <summary>
        /// 服务器Icon按钮
        /// </summary>
        Button btnServerIcon;
        /// <summary>
        /// 服务器文本框
        /// </summary>
        Button btnServerText;
        ///// <summary>
        ///// 服务器文本框
        ///// </summary>
        //EditText etServer;
        ///// <summary>
        ///// 服务器子区域里面的分割线1
        ///// </summary>
        //Button btnLineVertical_server;
        /// <summary>
        ///服务器go按钮
        /// </summary>
        Button btnServerGo;
        /// <summary>
        /// 服务器子区域底部横线
        /// </summary>
        Button btnServerBottomLine;
        #endregion
        /// <summary>
        /// 账号子区域
        /// </summary>
        FrameLayout accountView;
        /// <summary>
        /// 国际区号按钮
        /// </summary>
        Button btnGlobalRoaming;
        /// <summary>
        /// 账号子区域里面的分割线
        /// </summary>
        Button btnDividingLineVertical_AccountView;
        /// <summary>
        /// 账号文本框
        /// </summary>
        EditText etAccount;
        /// <summary>
        /// 账号Icon按钮
        /// </summary>
        Button btnAccountIcon;
        /// <summary>
        /// 账号子区域底部横线
        /// </summary>
        Button btnVerificationCodeViewBottomLine;
        /// <summary>
        /// 密码子区域
        /// </summary>
        FrameLayout passwordView;
        /// <summary>
        /// 密码Icon按钮
        /// </summary>
        Button btnPasswordIcon;
        /// <summary>
        /// 密码文本框
        /// </summary>
        EditText etPassword;
        /// <summary>
        /// 密码子区域里面的分割线1
        /// </summary>
        Button btnDividingLineVertical_PasswordView1;
        /// <summary>
        /// 密码是否可见按钮
        /// </summary>
        Button btnVisiblePassword;
        /// <summary>
        /// 密码子区域底部横线
        /// </summary>
        Button btnPasswordViewBottomLine;
 
        /// <summary>
        /// 确认密码子区域
        /// </summary>
        FrameLayout repeatPasswordView;
        /// <summary>
        /// 确认密码Icon按钮
        /// </summary>
        Button btnRepeatPasswordIcon;
        /// <summary>
        /// 确认密码文本框
        /// </summary>
        EditText etRepeatPassword;
        /// <summary>
        /// 确认密码子区域里面的分割线1
        /// </summary>
        Button btnRepeatDividingLineVertical_PasswordView1;
        /// <summary>
        /// 确认密码是否可见按钮
        /// </summary>
        Button btnRepeatVisiblePassword;
        /// <summary>
        /// 确认密码子区域底部横线
        /// </summary>
        Button btnRepeatPasswordViewBottomLine;
        /// <summary>
        /// 验证码子区域
        /// </summary>
        FrameLayout verificationCodeView;
        /// <summary>
        /// 验证码图标
        /// </summary>
        Button btnVerificationCodeIcon;
        /// <summary>
        /// 验证码子区域分割线
        /// </summary>
        Button btnDividingLineVertical_VerificationCodeView1;
        /// <summary>
        /// 验证码文本输入框
        /// </summary>
        EditText etVerificationCode;
        /// <summary>
        /// 获取验证码按钮
        /// </summary>
        Button btnGetVerificationCode_Phone;
        /// <summary>
        /// 获取验证码按钮
        /// </summary>
        Button btnGetVerificationCode_Mail;
        /// <summary>
        /// 验证码子区域底部分割线
        /// </summary>
        Button btnAccountViewBottomLine;
        /// <summary>
        /// 注册按钮
        /// </summary>
        Button btnRegister;
 
        #endregion
 
        #region  局部变量列表
        /// <summary>
        /// 账号类型
        /// 0:手机
        /// 1:邮箱
        /// </summary>
        int accountType = 0;
        /// <summary>
        /// 手机号码是否有效
        /// </summary>
        bool ValidMobileNumber = false;
        /// <summary>
        /// 密码是否有效
        /// </summary>
        bool ValidPassword = false;
        /// <summary>
        /// 服务器请求对象
        /// </summary>
        HttpServerRequest pm;
        /// <summary>
        /// 回调事件
        /// </summary>
        //Action callbackAction;
        /// <summary>
        /// 注册类型
        /// 0:手机
        /// 1:邮箱
        /// </summary>
        int registerType;
        /// <summary>
        /// 手机区号
        /// </summary>
        string phoneZoneCode = "86";
        /// <summary>
        /// 是否选择过服务器
        /// </summary>
        bool isSelectServer;
 
        string registerPhone;
        string registerEmail;
        #endregion
        public RegisterPage()
        {
            bodyView = new FrameLayout()
            {
                BackgroundColor = CSS_Color.BackgroundColor,
            };
            AddChidren(bodyView);
 
            pm = new HttpServerRequest();
        }
 
        //public RegisterPage(Action action)
        //{
        //    bodyView = new FrameLayout()
        //    {
        //        BackgroundColor = CSS_Color.MainBackgroundColor,
        //    };
        //    AddChidren(bodyView);
        //    pm = new HttpServerRequest();
        //    callbackAction = action;
        //}
 
        public void ShowDialog()
        {
            new TopViewDiv(this, bodyView, Language.StringByID(StringId.Register)).LoadTopView();
            //new PublicAssmebly().LoadTopView(this, bodyView, Language.StringByID(StringId.Register));
 
            #region 注册方式选择
            btnPhoneLogin = new Button()
            {
                X = Application.GetRealWidth(28),
                Y = Application.GetRealHeight(112),
                Width = Application.GetRealWidth(120),
                Height = Application.GetRealHeight(40),
                TextID = StringId.RegisterByPhone,
                TextColor = CSS_Color.MainColor,
                TextAlignment = TextAlignment.CenterLeft,
                TextSize = CSS_FontSize.EmphasisFontSize_Secondary,
            };
            bodyView.AddChidren(btnPhoneLogin);
 
            btnEmailLogin = new Button()
            {
                X = btnPhoneLogin.Right,
                Y = Application.GetRealHeight(112),
                Width = Application.GetRealWidth(100),
                Height = Application.GetRealHeight(40),
                TextID = StringId.RegisterByEmail,
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.Center,
                TextSize = CSS_FontSize.TextFontSize,
            };
            bodyView.AddChidren(btnEmailLogin);
            #endregion
 
            #region 服务器选择
            serverView = new FrameLayout()
            {
                X = Application.GetRealWidth(28),
                Y = Application.GetRealHeight(167),
                Width = Application.GetRealWidth(319),
                Height = Application.GetRealHeight(44),
            };
            bodyView.AddChidren(serverView);
 
            btnServerIcon = new Button()
            {
                X = Application.GetRealWidth(9),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(20),
                Height = Application.GetMinRealAverage(20),
                UnSelectedImagePath = "LoginIcon/Server.png",
 
            };
            serverView.AddChidren(btnServerIcon);
 
            btnServerText = new Button()
            {
                X = Application.GetRealWidth(49),
                Width = Application.GetRealWidth(319 - 78),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.TextFontSize,
                TextID = StringId.PleaseSelectCountryOrRegion,
            };
            serverView.AddChidren(btnServerText);
 
            #region 密码登录-控件加载
            btnServerGo = new Button()
            {
                X = Application.GetRealWidth(303),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(16),
                Height = Application.GetMinRealAverage(16),
                UnSelectedImagePath = "Public/Right.png",
            };
            serverView.AddChidren(btnServerGo);
 
            #endregion
            btnServerBottomLine = new Button()
            {
                Y = Application.GetRealHeight(42),
                BackgroundColor = CSS_Color.DividingLineColor,
                SelectedBackgroundColor = CSS_Color.MainColor,
                Height = Application.GetRealHeight(1),
            };
            serverView.AddChidren(btnServerBottomLine);
            #endregion
 
            int topPadding = Application.GetRealHeight(12);
            #region 账号填写
            accountView = new FrameLayout()
            {
                X = Application.GetRealWidth(28),
                Y = serverView.Bottom + topPadding,
                Width = Application.GetRealWidth(319),
                Height = Application.GetRealHeight(44),
            };
            bodyView.AddChidren(accountView);
 
            btnGlobalRoaming = new Button()
            {
                Width = Application.GetRealWidth(57),
                X = Application.GetRealWidth(9),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                Text = "+" + phoneZoneCode,
                TextSize = CSS_FontSize.TextFontSize,
            };
 
            //跳转国家区号选择界面
            EventHandler<MouseEventArgs> eHandler = (sender, e) => {
                JLCountrycode.CountryCodeView.Current.Show((countryName, code) => {
                    if (!string.IsNullOrEmpty(code))
                    {
                        phoneZoneCode = code;
                        btnGlobalRoaming.Text = "+" + phoneZoneCode;
                    }
                });
            };
            btnGlobalRoaming.MouseUpEventHandler += eHandler;
 
            if (accountType == 0)
            {
                accountView.AddChidren(btnGlobalRoaming);
            }
 
            //btnDividingLineVertical_AccountView = new Button()
            //{
            //    X = Application.GetRealWidth(65),
            //    Gravity = Gravity.CenterVertical,
            //    Width = 1,
            //    Height = Application.GetRealHeight(20),
            //    BackgroundColor = CSS_Color.DividingLineColor,
            //};
            //accountView.AddChidren(btnDividingLineVertical_AccountView);
 
            etAccount = new EditText()
            {
                X = Application.GetRealWidth(49),
                Width = Application.GetRealWidth(319 - 78),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                PlaceholderTextColor = CSS_Color.PromptingColor1,
                PlaceholderText = Language.StringByID(StringId.PlsEntryPhoneNumber),
                IsNumberKeyboardType = true
            };
            accountView.AddChidren(etAccount);
 
            btnAccountViewBottomLine = new Button()
            {
                Y = Application.GetRealHeight(42),
                BackgroundColor = CSS_Color.DividingLineColor,
                Height = Application.GetRealHeight(1),
            };
            accountView.AddChidren(btnAccountViewBottomLine);
 
            btnAccountIcon = new Button()
            {
                X = Application.GetRealWidth(9),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(20),
                Height = Application.GetMinRealAverage(20),
                UnSelectedImagePath = "LoginIcon/AccountIcon.png",
            };
            if (accountType == 1)
            {
                accountView.AddChidren(btnAccountIcon);
            }
            #endregion
 
            #region 密码填写
            passwordView = new FrameLayout()
            {
                X = Application.GetRealWidth(28),
                Y = accountView.Bottom + topPadding,
                Width = Application.GetRealWidth(319),
                Height = Application.GetRealHeight(44),
            };
            bodyView.AddChidren(passwordView);
 
            btnPasswordIcon = new Button()
            {
                X = Application.GetRealWidth(9),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(20),
                Height = Application.GetMinRealAverage(20),
                UnSelectedImagePath = "LoginIcon/PasswordIcon.png",
 
            };
            passwordView.AddChidren(btnPasswordIcon);
            //btnDividingLineVertical_PasswordView1 = new Button()
            //{
            //    X = Application.GetRealWidth(65),
            //    Gravity = Gravity.CenterVertical,
            //    Width = 1,
            //    Height = Application.GetRealHeight(20),
            //    BackgroundColor = CSS_Color.DividingLineColor,
            //};
            //passwordView.AddChidren(btnDividingLineVertical_PasswordView1);
 
            etPassword = new EditText()
            {
                X = Application.GetRealWidth(49),
                Width = Application.GetRealWidth(319 - 78),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                PlaceholderTextColor = CSS_Color.PromptingColor1,
                PlaceholderText = Language.StringByID(StringId.PlsRegisterPassword),
                SecureTextEntry = true,
            };
            passwordView.AddChidren(etPassword);
 
            #region 密码登录-控件加载
            btnVisiblePassword = new Button()
            {
                X = Application.GetRealWidth(295),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(20),
                Height = Application.GetMinRealAverage(20),
                UnSelectedImagePath = "LoginIcon/HidePasswordIcon.png",
                SelectedImagePath = "LoginIcon/ShowPasswordIcon.png",
            };
            passwordView.AddChidren(btnVisiblePassword);
 
            #endregion
            btnPasswordViewBottomLine = new Button()
            {
                Y = Application.GetRealHeight(42),
                BackgroundColor = CSS_Color.DividingLineColor,
                SelectedBackgroundColor = CSS_Color.MainColor,
                Height = Application.GetRealHeight(1),
            };
            passwordView.AddChidren(btnPasswordViewBottomLine);
            #endregion
 
            #region 确认密码填写
            repeatPasswordView = new FrameLayout()
            {
                X = Application.GetRealWidth(28),
                Y = passwordView.Bottom + topPadding,
                Width = Application.GetRealWidth(319),
                Height = Application.GetRealHeight(44),
            };
            bodyView.AddChidren(repeatPasswordView);
 
            btnRepeatPasswordIcon = new Button()
            {
                X = Application.GetRealWidth(9),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(20),
                Height = Application.GetMinRealAverage(20),
                UnSelectedImagePath = "LoginIcon/PasswordIcon.png",
 
            };
            repeatPasswordView.AddChidren(btnRepeatPasswordIcon);
            //btnRepeatDividingLineVertical_PasswordView1 = new Button()
            //{
            //    X = Application.GetRealWidth(65),
            //    Gravity = Gravity.CenterVertical,
            //    Width = 1,
            //    Height = Application.GetRealHeight(20),
            //    BackgroundColor = CSS_Color.DividingLineColor,
            //};
            //repeatPasswordView.AddChidren(btnRepeatDividingLineVertical_PasswordView1);
 
            etRepeatPassword = new EditText()
            {
                X = Application.GetRealWidth(49),
                Width = Application.GetRealWidth(319 - 78),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                PlaceholderTextColor = CSS_Color.PromptingColor1,
                PlaceholderText = Language.StringByID(StringId.PlsRegisterRepeatPassword),
                SecureTextEntry = true,
            };
            repeatPasswordView.AddChidren(etRepeatPassword);
 
            #region 密码登录-控件加载
            btnRepeatVisiblePassword = new Button()
            {
                X = Application.GetRealWidth(295),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(20),
                Height = Application.GetMinRealAverage(20),
                UnSelectedImagePath = "LoginIcon/HidePasswordIcon.png",
                SelectedImagePath = "LoginIcon/ShowPasswordIcon.png",
            };
            repeatPasswordView.AddChidren(btnRepeatVisiblePassword);
 
            #endregion
 
            btnRepeatPasswordViewBottomLine = new Button()
            {
                Y = Application.GetRealHeight(42),
                BackgroundColor = CSS_Color.DividingLineColor,
                SelectedBackgroundColor = CSS_Color.MainColor,
                Height = Application.GetRealHeight(1),
            };
            repeatPasswordView.AddChidren(btnRepeatPasswordViewBottomLine);
 
            #endregion
 
            #region 验证码填写
            verificationCodeView = new FrameLayout()
            {
                X = Application.GetRealWidth(28),
                Y = repeatPasswordView.Bottom + topPadding,
                //Y = Application.GetRealHeight(335),
                Width = Application.GetRealWidth(319),
                Height = Application.GetRealHeight(44),
            };
            bodyView.AddChidren(verificationCodeView);
 
            btnVerificationCodeIcon = new Button()
            {
                X = Application.GetRealWidth(9),
                Gravity = Gravity.CenterVertical,
                Width = Application.GetMinRealAverage(20),
                Height = Application.GetMinRealAverage(20),
                UnSelectedImagePath = "LoginIcon/VerificationCodeIcon.png",
            };
            verificationCodeView.AddChidren(btnVerificationCodeIcon);
 
            //btnDividingLineVertical_VerificationCodeView1 = new Button()
            //{
            //    X = Application.GetRealWidth(65),
            //    Gravity = Gravity.CenterVertical,
            //    Width = 1,
            //    Height = Application.GetRealHeight(20),
            //    BackgroundColor = CSS_Color.DividingLineColor,
            //};
            //verificationCodeView.AddChidren(btnDividingLineVertical_VerificationCodeView1);
 
            etVerificationCode = new EditText()
            {
                X = Application.GetRealWidth(49),
                Width = Application.GetRealWidth(61 + 84),
                TextAlignment = TextAlignment.CenterLeft,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                PlaceholderTextColor = CSS_Color.PromptingColor1,
                PlaceholderText = Language.StringByID(StringId.PlsEntryVerificationCode),
            };
            verificationCodeView.AddChidren(etVerificationCode);
 
            btnGetVerificationCode_Phone = new Button()
            {
                X = Application.GetRealWidth(219),
                Width = Application.GetRealWidth(100),
                TextID = StringId.GetVerificationCode,
                SelectedTextColor = CSS_Color.MainColor,
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
            };
            verificationCodeView.AddChidren(btnGetVerificationCode_Phone);
 
            btnGetVerificationCode_Mail = new Button()
            {
                X = Application.GetRealWidth(219),
                Width = Application.GetRealWidth(100),
                TextID = StringId.GetVerificationCode,
                SelectedTextColor = CSS_Color.MainColor,
                TextColor = CSS_Color.PromptingColor1,
                TextAlignment = TextAlignment.CenterRight,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                Visible = false
            };
            verificationCodeView.AddChidren(btnGetVerificationCode_Mail);
 
            btnVerificationCodeViewBottomLine = new Button()
            {
                Y = Application.GetRealHeight(42),
                BackgroundColor = CSS_Color.DividingLineColor,
                SelectedBackgroundColor = CSS_Color.MainColor,
                Height = Application.GetRealHeight(1),
            };
            verificationCodeView.AddChidren(btnVerificationCodeViewBottomLine);
 
            #endregion
 
            btnRegister = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = verificationCodeView.Bottom + Application.GetRealHeight(42),
                //Y = Application.GetRealHeight(421),
                Width = Application.GetRealWidth(220),
                Height = Application.GetRealWidth(44),
                Radius = (uint)Application.GetRealWidth(22),
                SelectedBackgroundColor = CSS_Color.MainColor,
                BackgroundColor = CSS_Color.PromptingColor1,
                TextID = StringId.Register,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextColor = CSS_Color.MainBackgroundColor,
                TextAlignment = TextAlignment.Center,
            };
            bodyView.AddChidren(btnRegister);
 
            LoadEventList();
        }
 
 
        /// <summary>
        /// 注册成功之后自动登录
        /// </summary>
        void LoadEvent_AutoLogin(string account, string password)
        {
            Dialog dialog = new Dialog();
 
            FrameLayout frame = new FrameLayout()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(198),
                Width = Application.GetRealWidth(288),
                Height = Application.GetRealHeight(206),
                BackgroundColor = CSS_Color.MainBackgroundColor,
                Radius = (uint)Application.GetRealWidth(12),
                BorderWidth = 0,
                BorderColor = 0x00000000,
            };
            dialog.AddChidren(frame);
 
            Button btnAccountText = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(40),
                Height = Application.GetRealHeight(17 + 14 + 14),
                IsMoreLines = true,
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.FirstLevelTitleColor,
                TextSize = CSS_FontSize.TextFontSize,
                Text = account,
            };
            frame.AddChidren(btnAccountText);
 
            Button btnTipRegisterSuccess = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(123),
                Height = Application.GetRealHeight(30),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.MainColor,
                TextSize = CSS_FontSize.SubheadingFontSize,
                TextID = StringId.CongratulationsRegistration,
            };
            frame.AddChidren(btnTipRegisterSuccess);
 
            Button btnAutoLoginTip = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = btnTipRegisterSuccess.Bottom,
                Height = Application.GetRealHeight(17 + 8),
                TextAlignment = TextAlignment.Center,
                TextColor = CSS_Color.PromptingColor1,
                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
                TextID = StringId.AutomaticallyLogin,
            };
            frame.AddChidren(btnAutoLoginTip);
 
            Button btnHeadImage = new Button()
            {
                Gravity = Gravity.CenterHorizontal,
                Y = Application.GetRealHeight(150),
                Width = Application.GetRealWidth(84),
                Height = Application.GetRealWidth(84),
                Radius = (uint)Application.GetRealWidth(42),
                BorderColor = 0x00000000,
                BorderWidth = 0,
                UnSelectedImagePath = "LoginIcon/2.png",
            };
            dialog.AddChidren(btnHeadImage);
 
            dialog.Show();
 
            new Thread(() =>
            {
                Thread.Sleep(1500);
                Application.RunOnMainThread(() =>
                {
                    //创建登录线程
                    var loginThread = LoadThread_Login(account, password);
                    waitPage = new Loading();
                    new PublicAssmebly().LoadPage_WaitPage(loginThread, bodyView, waitPage);
                    dialog.Close();
                });
            })
            { IsBackground = true }.Start();
        }
 
        #region 登录线程部分
        /// <summary>
        /// 加载登录线程
        /// </summary>
        Thread LoadThread_Login(string account,string password)
        {
            var loginThread = new Thread(() =>
            {
                try
                {
                    //登录
                    var loginResult = LoadMethod_Login(account,password);
                    if (loginResult)
                    {
                        //获取住宅信息
                        var getResidencesResult = LoadMethod_GetResidences();
                        if (getResidencesResult)
                        {
                            /*
                             * Wait : 推送注册
                             */
 
                            Application.RunOnMainThread(() =>
                            {
                                waitPage.RemoveFromParent();
                                waitPage = null;
 
                                //跳转页面----
                                MainPage.GoUserPage();
                            });
                        }
                    }
                }
                catch (Exception ex)
                {
                    MainPage.Log($"LoginPage : {ex.Message}");
                }
            })
            { IsBackground = true };
            return loginThread;
        }
 
        /// <summary>
        /// 调用登录接口登录
        /// </summary>
        bool LoadMethod_Login(string account, string password)
        {
            var result = false;
            //调用登录接口
            var loginResult = pm.LoginByPassword(account, password);
            if (loginResult.Code == StateCode.SUCCESS)
            {
                var revertData = Newtonsoft.Json.JsonConvert.DeserializeObject<UserLoginRes>(loginResult.Data.ToString());
                // UserInfo.Current = new UserInfo
                //{
                //    userType = revertData.userType,
                //    accountString = account,
                //    password = password,
                //    lastTime = DateTime.Now,
                //    ID = revertData.userId,
                //    loginTokenString = revertData.headerPrefix + revertData.accessToken,
                //    refreshToken = revertData.refreshToken,
                //    userName = revertData.name
                //};
                UserInfo.Current.userType = revertData.userType;
                UserInfo.Current.accountString = account;
                //UserInfo.Current.password = password;
                UserInfo.Current.lastTime = DateTime.Now;
                UserInfo.Current.ID = revertData.userId;
                UserInfo.Current.loginTokenString = revertData.headerPrefix + revertData.accessToken;
                UserInfo.Current.refreshToken = revertData.refreshToken;
                UserInfo.Current.userName = revertData.name;
 
                UserInfo.Current.SaveUserInfo();
                MainPage.Log("登录成功。");
                result = true;
            }
            else
            {
                //登录失败
                IMessageCommon.Current.ShowErrorInfoAlter(loginResult.Code);
                Application.RunOnMainThread(() =>
                {
                    btnPasswordViewBottomLine.BackgroundColor = CSS_Color.AuxiliaryColor2;
                    btnPasswordViewBottomLine.Height = Application.GetRealHeight(2);
                });
            }
            return result;
        }
 
        /// <summary>
        /// 获取住宅列表
        /// </summary>
        bool LoadMethod_GetResidences()
        {
            var result = false;
            var responsePack = pm.GetHomePager();
            if (responsePack == StateCode.SUCCESS)
            {
                //2020-11-13 待确认,没有住宅,不算登录成功
                if (UserInfo.Current.regionList != null && UserInfo.Current.regionList.Count > 0)
                {
                    result = true;
                }
            }
            else
            {
                IMessageCommon.Current.ShowErrorInfoAlter(responsePack);
            }
            return result;
        }
        #endregion
    }
}