黄学彪
2020-12-16 0d9f64668fd7350d6a21fd157e32009a96d98134
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
using System;
using System.Collections.Generic;
using Shared.Common;
using Shared.Phone.Device.CommonForm;
using Shared.Phone.UserCenter;
 
namespace Shared.Phone.Login
{
    /// <summary>
    /// 注册界面(注:此界面特殊,需要避开底层的处理)
    /// </summary>
    public class AccountRegisterForm : EditorCommonForm
    {
        #region ■ 变量声明___________________________
 
        /// <summary>
        /// 1:手机号 2:邮箱
        /// </summary>
        private int SelectIndex = 1;
        /// <summary>
        /// 输入的手机号(防止二次更改)
        /// </summary>
        private string strInputPhone = string.Empty;
        /// <summary>
        /// 输入的邮箱(防止二次更改)
        /// </summary>
        private string strInputEmail = string.Empty;
        /// <summary>
        /// 当前的输入控件 0:手机号或者邮箱  1:第一次密码  2:第二次密码  3:验证码
        /// </summary>
        private List<TextInputControl> ListNowInputControl = new List<TextInputControl> { null, null, null, null };
        /// <summary>
        /// 错误提示控件
        /// </summary>
        private NormalViewControl btnErrorMsg = null;
        /// <summary>
        /// 注册按钮
        /// </summary>
        private BottomClickButton btnRegister = null;
        /// <summary>
        /// 第三方绑定的id
        /// </summary>
        private string strOpenID = string.Empty;
 
        #endregion
 
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 界面显示
        /// </summary>
        /// <param name="i_OpenID">第三方绑定的id</param>
        public void ShowForm(string i_OpenID)
        {
            this.strOpenID = i_OpenID;
            CommonPage.Instance.IsDrawerLockMode = true;
            this.Tag = "Register";
 
            //初始化头部控件
            base.InitTopFrameLayout();
            //初始化中部控件
            base.InitBodyFrameLayout();
            base.SetTitleText(Language.StringByID(R.MyInternationalizationString.Register));
 
            //注册按钮
            this.btnRegister = new BottomClickButton(688);
            btnRegister.Y = Application.GetRealHeight(1281);
            btnRegister.TextID = R.MyInternationalizationString.Register;
            btnRegister.oldBackgroundColor = UserCenterColor.Current.ClickButtonDefultColor;
            bodyFrameLayout.AddChidren(btnRegister);
            btnRegister.CanClick = false;
            btnRegister.ButtonClickEvent += (sender, e) =>
            {
                //注册用户
                this.RegisterAccount();
            };
 
            //已有账号?登录
            var btnTip = new NormalViewControl(400, 58, true);
            btnTip.Y = btnRegister.Bottom + Application.GetRealHeight(50);
            btnTip.TextID = R.MyInternationalizationString.LoginByAccountPWD_1;
            btnTip.TextColor = ZigbeeColor.Current.GXCTextGrayColor;
            btnTip.TextSize = 12;
            btnTip.TextAlignment = TextAlignment.Center;
            btnTip.Gravity = Gravity.CenterHorizontal;
            bodyFrameLayout.AddChidren(btnTip);
            btnTip.ButtonClickEvent += (sender, e) =>
            {
                this.CloseForm();
            };
 
            //几个输入控件的集合
            var listControl = new List<TextInputControl>();
            //初始化手机号输入控件
            var framePhone = this.InitPhoneInputView(ref listControl);
            //初始化邮箱输入控件
            var frameEmail = this.InitEmailInputView(ref listControl);
 
            //错误提示Btn
            this.btnErrorMsg = new NormalViewControl(700, 58, true);
            btnErrorMsg.X = Application.GetRealWidth(156);
            btnErrorMsg.Y = Application.GetRealHeight(1060);
            btnErrorMsg.TextColor = ZigbeeColor.Current.GXCTextRed;
            btnErrorMsg.IsBold = true;
            bodyFrameLayout.AddChidren(btnErrorMsg);
 
            //邮箱,手机号的切换控件
            var sitchControl = new Controls.PhoneEmailSelectControl();
            sitchControl.Y = Application.GetRealHeight(127);
            bodyFrameLayout.AddChidren(sitchControl);
 
            sitchControl.SelectMenuEvent += (selectMenu) =>
            {
                this.SelectIndex = selectMenu;
                //手机号
                if (this.SelectIndex == 1)
                {
                    framePhone.Visible = true;
                    frameEmail.Visible = false;
                    //当前的输入控件
                    ListNowInputControl[0] = listControl[0];
                    ListNowInputControl[1] = listControl[1];
                    ListNowInputControl[2] = listControl[2];
                    ListNowInputControl[3] = listControl[3];
                }
                //邮箱
                else if (this.SelectIndex == 2)
                {
                    framePhone.Visible = false;
                    frameEmail.Visible = true;
                    //当前的输入控件
                    ListNowInputControl[0] = listControl[4];
                    ListNowInputControl[1] = listControl[5];
                    ListNowInputControl[2] = listControl[6];
                    ListNowInputControl[3] = listControl[7];
                }
                //检测注册按钮的状态
                this.CheckRegisterButtonStatu();
            };
            //执行初始化
            sitchControl.InitControl(ZigbeeColor.Current.GXCButtonBlackSelectedColor, 1);
        }
 
        /// <summary>
        ///  初始化手机号输入的界面
        /// </summary>
        /// <param name="listControl">几个输入控件的集合</param>
        /// <returns></returns>
        private FrameLayout InitPhoneInputView(ref List<TextInputControl> listControl)
        {
            //背景框
            var frameBack = new FrameLayout();
            frameBack.Y = Application.GetRealHeight(334);
            frameBack.Height = Application.GetRealHeight(852);
            frameBack.Width = Application.GetRealWidth(942);
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
            frameBack.Radius = (uint)Application.GetRealHeight(17);
            bodyFrameLayout.AddChidren(frameBack);
 
            //手机号行的容器
            var framePhone = new FrameLayout();
            framePhone.X = Application.GetRealWidth(29);
            framePhone.Y = Application.GetRealHeight(29);
            framePhone.Width = Application.GetRealWidth(884);
            framePhone.Height = Application.GetRealHeight(138);
            frameBack.AddChidren(framePhone);
            //地区码
            var btnAreaCode = new NormalViewControl(160, 92, true);
            btnAreaCode.Gravity = Gravity.CenterVertical;
            btnAreaCode.TextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            btnAreaCode.Text = $"+{CommonPage.PhoneZoneStr}";
            btnAreaCode.TextAlignment = TextAlignment.Center;
            framePhone.AddChidren(btnAreaCode);
            //手机号输入框
            var txtPhone = new TextInputControl(600, 92, true);
            txtPhone.X = Application.GetRealWidth(222);
            txtPhone.Gravity = Gravity.CenterVertical;
            txtPhone.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPhoneNum);
            txtPhone.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            txtPhone.IsNumberKeyboardType = true;
            framePhone.AddChidren(txtPhone);
            listControl.Add(txtPhone);
 
            //手机号输入框的底线
            var btnPhoneLine = new NormalViewControl(framePhone.Width, HdlControlResourse.BottomLineHeight, false);
            btnPhoneLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
            btnPhoneLine.Y = framePhone.Height - HdlControlResourse.BottomLineHeight;
            framePhone.AddChidren(btnPhoneLine);
            //联动底线
            txtPhone.btnLine = btnPhoneLine;
 
            //第一次密码的容器
            var framePswOne = new FrameLayout();
            framePswOne.X = Application.GetRealWidth(29);
            framePswOne.Y = Application.GetRealHeight(196);
            framePswOne.Width = framePhone.Width;
            framePswOne.Height = framePhone.Height;
            frameBack.AddChidren(framePswOne);
            //图标
            var btnPswOneIcon = new IconViewControl(92);
            btnPswOneIcon.X = Application.GetRealWidth(29);
            btnPswOneIcon.Gravity = Gravity.CenterVertical;
            btnPswOneIcon.UnSelectedImagePath = "Account/Password.png";
            framePswOne.AddChidren(btnPswOneIcon);
            //第一次密码的输入框
            var txtPswOne = new TextInputControl(550, 92, true);
            txtPswOne.X = Application.GetRealWidth(222);
            txtPswOne.Gravity = Gravity.CenterVertical;
            txtPswOne.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
            txtPswOne.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            txtPswOne.SecureTextEntry = true;
            framePswOne.AddChidren(txtPswOne);
            listControl.Add(txtPswOne);
            //第一次密码可视图标
            var btnPswOneHiden = new IconViewControl(92);
            btnPswOneHiden.X = Application.GetRealWidth(775);
            btnPswOneHiden.Gravity = Gravity.CenterVertical;
            btnPswOneHiden.SelectedImagePath = "Account/HidePwd.png";
            btnPswOneHiden.UnSelectedImagePath = "Account/UnhidePwd.png";
            btnPswOneHiden.IsSelected = true;
            framePswOne.AddChidren(btnPswOneHiden);
            btnPswOneHiden.ButtonClickEvent += (sender, e) =>
            {
                btnPswOneHiden.IsSelected = !btnPswOneHiden.IsSelected;
                txtPswOne.SecureTextEntry = btnPswOneHiden.IsSelected;
            };
            //第一次密码输入框的底线
            var btnPswOneLine = new NormalViewControl(framePswOne.Width, HdlControlResourse.BottomLineHeight, false);
            btnPswOneLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
            btnPswOneLine.Y = framePswOne.Height - HdlControlResourse.BottomLineHeight;
            framePswOne.AddChidren(btnPswOneLine);
            //联动底线
            txtPswOne.btnLine = btnPswOneLine;
 
            //第二次密码的容器
            var framePswTwo = new FrameLayout();
            framePswTwo.X = Application.GetRealWidth(29);
            framePswTwo.Y = Application.GetRealHeight(363);
            framePswTwo.Width = framePhone.Width;
            framePswTwo.Height = framePhone.Height;
            frameBack.AddChidren(framePswTwo);
            //图标
            var btnPswTwoIcon = new IconViewControl(92);
            btnPswTwoIcon.X = Application.GetRealWidth(29);
            btnPswTwoIcon.Gravity = Gravity.CenterVertical;
            btnPswTwoIcon.UnSelectedImagePath = "Account/Password.png";
            framePswTwo.AddChidren(btnPswTwoIcon);
            //第二次密码的输入框
            var txtPswTwo = new TextInputControl(550, 92, true);
            txtPswTwo.X = Application.GetRealWidth(222);
            txtPswTwo.Gravity = Gravity.CenterVertical;
            txtPswTwo.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
            txtPswTwo.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            txtPswTwo.SecureTextEntry = true;
            framePswTwo.AddChidren(txtPswTwo);
            listControl.Add(txtPswTwo);
            //第二次密码可视图标
            var btnPswTwoHiden = new IconViewControl(92);
            btnPswTwoHiden.X = Application.GetRealWidth(775);
            btnPswTwoHiden.Gravity = Gravity.CenterVertical;
            btnPswTwoHiden.SelectedImagePath = "Account/HidePwd.png";
            btnPswTwoHiden.UnSelectedImagePath = "Account/UnhidePwd.png";
            btnPswTwoHiden.IsSelected = true;
            framePswTwo.AddChidren(btnPswTwoHiden);
            btnPswTwoHiden.ButtonClickEvent += (sender, e) =>
            {
                btnPswTwoHiden.IsSelected = !btnPswTwoHiden.IsSelected;
                txtPswTwo.SecureTextEntry = btnPswTwoHiden.IsSelected;
            };
            //第二次密码输入框的底线
            var btnPswTwoLine = new NormalViewControl(framePswTwo.Width, HdlControlResourse.BottomLineHeight, false);
            btnPswTwoLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
            btnPswTwoLine.Y = framePswTwo.Height - HdlControlResourse.BottomLineHeight;
            framePswTwo.AddChidren(btnPswTwoLine);
            //联动底线
            txtPswTwo.btnLine = btnPswTwoLine;
 
            //验证码的容器
            var frameCode = new FrameLayout();
            frameCode.X = Application.GetRealWidth(29);
            frameCode.Y = Application.GetRealHeight(530);
            frameCode.Width = framePhone.Width;
            frameCode.Height = framePhone.Height;
            frameBack.AddChidren(frameCode);
            //图标
            var btnCodeIcon = new IconViewControl(92);
            btnCodeIcon.X = Application.GetRealWidth(29);
            btnCodeIcon.Gravity = Gravity.CenterVertical;
            btnCodeIcon.UnSelectedImagePath = "Account/Code.png";
            frameCode.AddChidren(btnCodeIcon);
            //验证码输入框
            var txtCode = new TextInputControl(300, 92, true);
            txtCode.X = Application.GetRealWidth(222);
            txtCode.Gravity = Gravity.CenterVertical;
            txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode);
            txtCode.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            frameCode.AddChidren(txtCode);
            listControl.Add(txtCode);
            //获取验证码
            var btnSendCode = new NormalViewControl(300, 127, true);
            btnSendCode.X = frameCode.Width - Application.GetRealWidth(300);
            btnSendCode.Gravity = Gravity.CenterVertical;
            btnSendCode.TextID = R.MyInternationalizationString.SendVerificationCode;
            btnSendCode.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
            btnSendCode.TextAlignment = TextAlignment.Center;
            btnSendCode.BackgroundColor = 0xFFFEBCA9;
            btnSendCode.CanClick = false;
            btnSendCode.Radius = (uint)Application.GetRealHeight(12);
            btnSendCode.IsBold = true;
            frameCode.AddChidren(btnSendCode);
            btnSendCode.ButtonClickEvent += (sender, e) =>
            {
                //发送验证码
                this.SendVerificationCode(btnSendCode);
            };
            //获取验证码的底线
            var btnCodeLine = new NormalViewControl(Application.GetRealWidth(536), HdlControlResourse.BottomLineHeight, false);
            btnCodeLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
            btnCodeLine.Y = frameCode.Height - HdlControlResourse.BottomLineHeight;
            frameCode.AddChidren(btnCodeLine);
            //联动底线
            txtCode.btnLine = btnCodeLine;
            //验证码输入变更时
            txtCode.TextChangeEventHandler += (sender, value) =>
            {
                //检测注册按钮的状态
                this.CheckRegisterButtonStatu();
            };
            //手机号输入变更时
            txtPhone.TextChangeEventHandler += (sender, value) =>
            {
                this.btnErrorMsg.Text = string.Empty;
                if (txtPhone.Text.Trim() != string.Empty)
                {
                    if (btnSendCode.CanClick == false)
                    {
                        btnSendCode.CanClick = true;
                        btnSendCode.BackgroundColor = 0xFFFC744B;
                    }
                }
                else
                {
                    btnSendCode.CanClick = false;
                    btnSendCode.BackgroundColor = 0xFFFEBCA9;
                }
            };
 
            return frameBack;
        }
 
        /// <summary>
        /// 初始化邮箱输入的界面
        /// </summary>
        /// <param name="listControl">几个输入控件的集合</param>
        /// <returns></returns>
        private FrameLayout InitEmailInputView(ref List<TextInputControl> listControl)
        {
            //背景框
            var frameBack = new FrameLayout();
            frameBack.Y = Application.GetRealHeight(334);
            frameBack.Height = Application.GetRealHeight(852);
            frameBack.Width = Application.GetRealWidth(942);
            frameBack.Gravity = Gravity.CenterHorizontal;
            frameBack.BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
            frameBack.Radius = (uint)Application.GetRealHeight(17);
            bodyFrameLayout.AddChidren(frameBack);
 
            //邮箱行的容器
            var frameEmail = new FrameLayout();
            frameEmail.X = Application.GetRealWidth(29);
            frameEmail.Y = Application.GetRealHeight(29);
            frameEmail.Width = Application.GetRealWidth(884);
            frameEmail.Height = Application.GetRealHeight(138);
            frameBack.AddChidren(frameEmail);
            //图标
            var btnEmailIcon = new IconViewControl(92);
            btnEmailIcon.X = Application.GetRealWidth(29);
            btnEmailIcon.Gravity = Gravity.CenterVertical;
            btnEmailIcon.UnSelectedImagePath = "Account/Account.png";
            frameEmail.AddChidren(btnEmailIcon);
            //邮箱输入框
            var txtEmail = new TextInputControl(600, 92, true);
            txtEmail.X = Application.GetRealWidth(222);
            txtEmail.Gravity = Gravity.CenterVertical;
            txtEmail.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputEmail);
            txtEmail.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            frameEmail.AddChidren(txtEmail);
            listControl.Add(txtEmail);
            //邮箱输入框的底线
            var btnEmailLine = new NormalViewControl(frameEmail.Width, HdlControlResourse.BottomLineHeight, false);
            btnEmailLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
            btnEmailLine.Y = frameEmail.Height - HdlControlResourse.BottomLineHeight;
            frameEmail.AddChidren(btnEmailLine);
            //联动底线
            txtEmail.btnLine = btnEmailLine;
 
            //第一次密码的容器
            var framePswOne = new FrameLayout();
            framePswOne.X = Application.GetRealWidth(29);
            framePswOne.Y = Application.GetRealHeight(196);
            framePswOne.Width = frameEmail.Width;
            framePswOne.Height = frameEmail.Height;
            frameBack.AddChidren(framePswOne);
            //图标
            var btnPswOneIcon = new IconViewControl(92);
            btnPswOneIcon.X = Application.GetRealWidth(29);
            btnPswOneIcon.Gravity = Gravity.CenterVertical;
            btnPswOneIcon.UnSelectedImagePath = "Account/Password.png";
            framePswOne.AddChidren(btnPswOneIcon);
            //第一次密码的输入框
            var txtPswOne = new TextInputControl(550, 92, true);
            txtPswOne.X = Application.GetRealWidth(222);
            txtPswOne.Gravity = Gravity.CenterVertical;
            txtPswOne.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
            txtPswOne.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            txtPswOne.SecureTextEntry = true;
            framePswOne.AddChidren(txtPswOne);
            listControl.Add(txtPswOne);
            //第一次密码可视图标
            var btnPswOneHiden = new IconViewControl(92);
            btnPswOneHiden.X = Application.GetRealWidth(775);
            btnPswOneHiden.Gravity = Gravity.CenterVertical;
            btnPswOneHiden.SelectedImagePath = "Account/HidePwd.png";
            btnPswOneHiden.UnSelectedImagePath = "Account/UnhidePwd.png";
            btnPswOneHiden.IsSelected = true;
            framePswOne.AddChidren(btnPswOneHiden);
            btnPswOneHiden.ButtonClickEvent += (sender, e) =>
            {
                btnPswOneHiden.IsSelected = !btnPswOneHiden.IsSelected;
                txtPswOne.SecureTextEntry = btnPswOneHiden.IsSelected;
            };
            //第一次密码输入框的底线
            var btnPswOneLine = new NormalViewControl(framePswOne.Width, HdlControlResourse.BottomLineHeight, false);
            btnPswOneLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
            btnPswOneLine.Y = framePswOne.Height - HdlControlResourse.BottomLineHeight;
            framePswOne.AddChidren(btnPswOneLine);
            //联动底线
            txtPswOne.btnLine = btnPswOneLine;
 
            //第二次密码的容器
            var framePswTwo = new FrameLayout();
            framePswTwo.X = Application.GetRealWidth(29);
            framePswTwo.Y = Application.GetRealHeight(363);
            framePswTwo.Width = frameEmail.Width;
            framePswTwo.Height = frameEmail.Height;
            frameBack.AddChidren(framePswTwo);
            //图标
            var btnPswTwoIcon = new IconViewControl(92);
            btnPswTwoIcon.X = Application.GetRealWidth(29);
            btnPswTwoIcon.Gravity = Gravity.CenterVertical;
            btnPswTwoIcon.UnSelectedImagePath = "Account/Password.png";
            framePswTwo.AddChidren(btnPswTwoIcon);
            //第二次密码的输入框
            var txtPswTwo = new TextInputControl(550, 92, true);
            txtPswTwo.X = Application.GetRealWidth(222);
            txtPswTwo.Gravity = Gravity.CenterVertical;
            txtPswTwo.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
            txtPswTwo.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            txtPswTwo.SecureTextEntry = true;
            framePswTwo.AddChidren(txtPswTwo);
            listControl.Add(txtPswTwo);
            //第二次密码可视图标
            var btnPswTwoHiden = new IconViewControl(92);
            btnPswTwoHiden.X = Application.GetRealWidth(775);
            btnPswTwoHiden.Gravity = Gravity.CenterVertical;
            btnPswTwoHiden.SelectedImagePath = "Account/HidePwd.png";
            btnPswTwoHiden.UnSelectedImagePath = "Account/UnhidePwd.png";
            btnPswTwoHiden.IsSelected = true;
            framePswTwo.AddChidren(btnPswTwoHiden);
            btnPswTwoHiden.ButtonClickEvent += (sender, e) =>
            {
                btnPswTwoHiden.IsSelected = !btnPswTwoHiden.IsSelected;
                txtPswTwo.SecureTextEntry = btnPswTwoHiden.IsSelected;
            };
            //第二次密码输入框的底线
            var btnPswTwoLine = new NormalViewControl(framePswTwo.Width, HdlControlResourse.BottomLineHeight, false);
            btnPswTwoLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
            btnPswTwoLine.Y = framePswTwo.Height - HdlControlResourse.BottomLineHeight;
            framePswTwo.AddChidren(btnPswTwoLine);
            //联动底线
            txtPswTwo.btnLine = btnPswTwoLine;
 
            //验证码的容器
            var frameCode = new FrameLayout();
            frameCode.X = Application.GetRealWidth(29);
            frameCode.Y = Application.GetRealHeight(530);
            frameCode.Width = frameEmail.Width;
            frameCode.Height = frameEmail.Height;
            frameBack.AddChidren(frameCode);
            //图标
            var btnCodeIcon = new IconViewControl(92);
            btnCodeIcon.X = Application.GetRealWidth(29);
            btnCodeIcon.Gravity = Gravity.CenterVertical;
            btnCodeIcon.UnSelectedImagePath = "Account/Code.png";
            frameCode.AddChidren(btnCodeIcon);
            //验证码输入框
            var txtCode = new TextInputControl(300, 92, true);
            txtCode.X = Application.GetRealWidth(222);
            txtCode.Gravity = Gravity.CenterVertical;
            txtCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode);
            txtCode.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
            frameCode.AddChidren(txtCode);
            listControl.Add(txtCode);
            //获取验证码
            var btnSendCode = new NormalViewControl(300, 127, true);
            btnSendCode.X = frameCode.Width - Application.GetRealWidth(300);
            btnSendCode.Gravity = Gravity.CenterVertical;
            btnSendCode.TextID = R.MyInternationalizationString.SendVerificationCode;
            btnSendCode.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
            btnSendCode.TextAlignment = TextAlignment.Center;
            btnSendCode.BackgroundColor = 0xFFFEBCA9;
            btnSendCode.CanClick = false;
            btnSendCode.Radius = (uint)Application.GetRealHeight(12);
            btnSendCode.IsBold = true;
            frameCode.AddChidren(btnSendCode);
            btnSendCode.ButtonClickEvent += (sender, e) =>
            {
                //发送验证码
                this.SendVerificationCode(btnSendCode);
            };
 
            //获取验证码的底线
            var btnCodeLine = new NormalViewControl(Application.GetRealWidth(536), HdlControlResourse.BottomLineHeight, false);
            btnCodeLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
            btnCodeLine.Y = frameCode.Height - HdlControlResourse.BottomLineHeight;
            frameCode.AddChidren(btnCodeLine);
            //联动底线
            txtCode.btnLine = btnCodeLine;
            //验证码输入变更时
            txtCode.TextChangeEventHandler += (sender, value) =>
            {
                //检测注册按钮的状态
                this.CheckRegisterButtonStatu();
            };
            //邮箱输入变更时
            txtEmail.TextChangeEventHandler += (sender, value) =>
            {
                this.btnErrorMsg.Text = string.Empty;
                if (txtEmail.Text.Trim() != string.Empty)
                {
                    if (btnSendCode.CanClick == false)
                    {
                        btnSendCode.CanClick = true;
                        btnSendCode.BackgroundColor = 0xFFFC744B;
                    }
                }
                else
                {
                    btnSendCode.CanClick = false;
                    btnSendCode.BackgroundColor = 0xFFFEBCA9;
                }
            };
 
            return frameBack;
        }
 
        #endregion
 
        #region ■ 发送验证码_________________________
 
        /// <summary>
        /// 发送验证码
        /// </summary>
        /// <param name="control"></param>
        private void SendVerificationCode(NormalViewControl control)
        {
            //检测输入的账号
            if (this.CheckInputAccount() == false)
            {
                return;
            }
            //不能再点击
            control.CanClick = false;
 
            var errorMsg = string.Empty;
            //手机
            if (this.SelectIndex == 1)
            {
                this.strInputPhone = ListNowInputControl[0].Text.Trim();
                errorMsg = HdlAccountLogic.Current.SendVeriCodeToPhone("86", this.strInputPhone, VerCodeType.A注册);
            }
            //邮箱
            else
            {
                this.strInputEmail = ListNowInputControl[0].Text.Trim();
                errorMsg = HdlAccountLogic.Current.SendVeriCodeToEmail(this.strInputEmail, VerCodeType.A注册);
            }
 
            if (errorMsg == null)
            {
                //发送验证码成功,请注意查收
                this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.SendVerificationCodeSuccess));
 
                control.BackgroundColor = UserCenterColor.Current.White;
                control.TextColor = ZigbeeColor.Current.GXCTextBlackColor;
 
                //启动倒计时
                HdlThreadLogic.Current.RunThread(() =>
                {
                    //后重发
                    string txtValue = Language.StringByID(R.MyInternationalizationString.SendVerificationCodeAgain);
                    int timeOut = 60;
                    while (timeOut > 0 && control.Parent != null)
                    {
                        HdlThreadLogic.Current.RunMain(() =>
                        {
                            control.Text = timeOut + "s" + txtValue;
                        });
                        timeOut--;
                        System.Threading.Thread.Sleep(1000);
                    }
                    HdlThreadLogic.Current.RunMain(() =>
                    {
                        control.TextID = R.MyInternationalizationString.SendVerificationCode;
                        control.BackgroundColor = 0xFFFC744B;
                        control.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
                        control.CanClick = true;
                    });
                });
                return;
            }
 
            this.btnErrorMsg.Text = errorMsg;
            control.CanClick = true;
        }
 
        #endregion
 
        #region ■ 注册用户___________________________
 
        /// <summary>
        /// 注册用户
        /// </summary>
        private void RegisterAccount()
        {
            //检测输入的账号
            if (this.CheckInputAccount() == false)
            {
                return;
            }
            //不能再点击
            this.btnRegister.CanClick = false;
 
            //注册
            var account = this.SelectIndex == 1 ? this.strInputPhone : this.strInputEmail;
            var errorMsg = HdlAccountLogic.Current.RegisterAccount(account, ListNowInputControl[1].Text.Trim(), ListNowInputControl[3].Text.Trim());
 
            if (errorMsg == null)
            {
                var registerSuccess = new AccountRegisterResultForm();
                CommonPage.Instance.AddChidren(registerSuccess);
                registerSuccess.ShowForm(this.SelectIndex == 1 ? this.strInputPhone : this.strInputEmail, ListNowInputControl[1].Text.Trim(), this.strOpenID);
                return;
            }
            this.btnErrorMsg.Text = errorMsg;
            //可以再次点击
            this.btnRegister.CanClick = true;
        }
 
        #endregion
 
        #region ■ 一般方法___________________________
 
        /// <summary>
        /// 检测注册按钮的状态
        /// </summary>
        private void CheckRegisterButtonStatu()
        {
            this.btnErrorMsg.Text = string.Empty;
            //只要有一个为空,则注册按钮不可用
            if (this.ListNowInputControl[0].Text.Trim() == string.Empty
                || this.ListNowInputControl[1].Text.Trim() == string.Empty
                || this.ListNowInputControl[2].Text.Trim() == string.Empty
                || this.ListNowInputControl[3].Text.Trim() == string.Empty)
            {
                this.btnRegister.CanClick = false;
                return;
            }
 
            this.btnRegister.CanClick = true;
        }
 
        /// <summary>
        /// 检测输入的账号
        /// </summary>
        /// <returns></returns>
        private bool CheckInputAccount()
        {
            this.btnErrorMsg.Text = string.Empty;
            //手机
            if (this.SelectIndex == 1)
            {
                if (HdlCheckLogic.Current.CheckPhoneNumber(ListNowInputControl[0].Text.Trim(), "86") == false)
                {
                    this.btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError;
                    return false;
                }
            }
            //邮箱
            else
            {
                if (HdlCheckLogic.Current.CheckEmail(ListNowInputControl[0].Text.Trim()) == false)
                {
                    this.btnErrorMsg.TextID = R.MyInternationalizationString.TheEmailError;
                    return false;
                }
            }
            //先判断2次密码输入是否一致
            if (ListNowInputControl[1].Text != ListNowInputControl[2].Text)
            {
                this.btnErrorMsg.TextID = R.MyInternationalizationString.TwoPasswordInconsistency;
                return false;
            }
 
            if (HdlCheckLogic.Current.CheckPwdLength(ListNowInputControl[1].Text.Trim()) == false)
            {
                this.btnErrorMsg.TextID = R.MyInternationalizationString.ThePWDLengthError;
                return false;
            }
 
            return true;
        }
 
        #endregion
    }
}