From 5a5a2b696866f947b6025d26c3302e8ffef46435 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期一, 11 一月 2021 16:11:20 +0800
Subject: [PATCH] 2021-01-11 1.更新MQTT连接和本地搜索网关方法。2.子账号相关接口完善

---
 Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ForgotPassword.cs |  515 +++++++++++++++++++--------------------------------------
 1 files changed, 172 insertions(+), 343 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ForgotPassword.cs b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ForgotPassword.cs
index d6f3709..4f5c8a7 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ForgotPassword.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/Phone/Register/ForgotPassword.cs
@@ -58,389 +58,160 @@
 
             bodyPageView = new PageLayout () {
                 Width = LayoutParams.MatchParent,
-                Height = Application.GetRealHeight (1136 - 126),
+                Height = Application.GetRealHeight (Application.DesignHeight - 126),
                 Y = topView.Bottom,
                 BackgroundColor = SkinStyle.Current.ViewColor,
             };
 
             AddChidren (bodyPageView);
 
-            bodyPageView.PageChange += ( sender,  e) => {
-                if (bodyPageView.ChildrenCount - 2 == e) {
-                    bodyPageView.RemoveAt (bodyPageView.ChildrenCount - 1);
+            bodyPageView.PageChange += (sender, e) => {
+                //2020-09-04 淇瀹夊崜鍙虫粦闂��闂
+                if (e < bodyPageView.ChildrenCount - 1) {
+                    bodyPageView.GetChildren (bodyPageView.ChildrenCount - 1).RemoveFromParent ();
                 }
-                Console.WriteLine ("D" + e.ToString ());
             };
+
 
             FrameLayout bodyView = new FrameLayout ();
             bodyPageView.AddChidren (bodyView);
             bodyPageView.IsShowPoint = false;
 
-            FrameLayout languageView = new FrameLayout () {
-                Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight (20),
-                Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
-                Radius = 5,
-                BorderColor = SkinStyle.Current.Transparent,
-                BorderWidth = 0,
-            };
-            bodyView.AddChidren (languageView);
-
-            Button btnEmailRegistration = new Button () {
-                Width = Application.GetRealWidth (250),
-                BackgroundColor = SkinStyle.Current.SubtitleView,
-                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
-                TextID = R.MyInternationalizationString.MailboxAccount,
-                TextAlignment = TextAlignment.Center,
-                IsSelected = true,
-                TextColor = SkinStyle.Current.TextColor2,
-            };
-            languageView.AddChidren (btnEmailRegistration);
-
-            Button btnPhoneRegistration = new Button () {
-                X = btnEmailRegistration.Right,
-                Width = Application.GetRealWidth (250),
-                BackgroundColor = SkinStyle.Current.SubtitleView,
-                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
-                TextID = R.MyInternationalizationString.MobileAccount,
-                TextAlignment = TextAlignment.Center,
-                TextColor = SkinStyle.Current.TextColor2,
-            };
-            languageView.AddChidren (btnPhoneRegistration);
-
-            FrameLayout FrameLayoutView = new FrameLayout () {
-                Y = languageView.Bottom,
-                Height = Application.GetRealHeight (1136 - 126 - 105),
-            };
-            bodyView.AddChidren (FrameLayoutView);
-
-            btnEmailRegistration.MouseUpEventHandler += (sender, e) => {
-                btnEmailRegistration.IsSelected = true;
-                btnPhoneRegistration.IsSelected = false;
-
-                EmailForgot (FrameLayoutView);
-            };
-            btnPhoneRegistration.MouseUpEventHandler += (sender, e) => {
-                btnEmailRegistration.IsSelected = false;
-                btnPhoneRegistration.IsSelected = true;
-
-                PhoneReagistrationView (FrameLayoutView);
-            };
-            EmailForgot (FrameLayoutView);
-
-            btnPhoneRegistration.RemoveFromParent ();
-            btnEmailRegistration.IsSelected = false;
-            btnEmailRegistration.BackgroundColor = SkinStyle.Current.Transparent;
-            btnEmailRegistration.X = Application.GetRealWidth (125);
-
+            EmailForgotView (bodyView);
         }
-
-        void EmailForgot (FrameLayout FrameLayoutView)
-        {
-            FrameLayoutView.RemoveAll ();
-            EditText Register_Email_Address = new EditText () {
-                Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
-                X = Application.GetRealWidth (70),
-                Y = Application.GetRealHeight (100),
-                UnSelectedImagePath = "Register/Register_Email_Address.png",
-                PlaceholderText = Language.StringByID (R.MyInternationalizationString.EmailAddress),
-                PlaceholderTextColor = SkinStyle.Current.PlaceholderTextColor,
-                TextAlignment = TextAlignment.Center,
-                Radius = (uint)Application.GetRealHeight (0),
-                TextColor = SkinStyle.Current.TextColor1,
-            };
-            FrameLayoutView.AddChidren (Register_Email_Address);
-            Register_Email_Address.EditorEnterAction += (obj) => {
-                Register_Email_Address.Foucs = false;
-                Application.HideSoftInput ();
-            };
-
-            Button Register_Send = new Button () {
-                Width = Application.GetRealWidth (247),
-                Height = Application.GetRealHeight (89),
-                X = Application.GetRealWidth ((640 - 247) / 2),
-                Y = Register_Email_Address.Bottom + Application.GetRealHeight (120),
-                BackgroundColor = SkinStyle.Current.ButtonColor1,
-                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
-                TextID = R.MyInternationalizationString.Send,
-                TextColor = SkinStyle.Current.TextColor2,
-                TextAlignment = TextAlignment.Center,
-                Radius = 5,
-                BorderColor = SkinStyle.Current.Transparent,
-                BorderWidth = 0,
-            };
-            FrameLayoutView.AddChidren (Register_Send);
-            Register_Send.MouseDownEventHandler += (sender, e) => {
-                Register_Send.IsSelected = true;
-            };
-
-            Register_Send.MouseUpEventHandler += (sender, e) => {
-                MainPage.Loading.Start ("Please wait...");
-                string emailAccount = Register_Email_Address.Text.Trim ();
-                Register_Send.Enable = false;
-                new System.Threading.Thread (() => {
-                    System.Threading.Thread.Sleep (10000);
-                    Application.RunOnMainThread (() => {
-                        try {
-                            if (Register_Send != null)
-                                Register_Send.Enable = true;
-                        } catch { }
-                    });
-                }) { IsBackground = true}.Start();
-                System.Threading.Tasks.Task.Run (() => {
-                    try {
-                        Register_Send.IsSelected = false;
-                    
-                        var reg = new Regex ("^\\s*([A-Za-z0-9_-]+(\\.\\w+)*@(\\w+\\.)+\\w{2,5})\\s*$");
-                        var ss = reg.Match (emailAccount);
-
-                        if (!ss.Success) {
-                            Application.RunOnMainThread (() => {
-                                new Alert ("", Language.StringByID (R.MyInternationalizationString.PleaseCheckEmailAddressCorrectly),
-                                                         Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                            });
-                        } else {
-                            var requestObj = new YdForgetPasswordObj () { Account = emailAccount, Company = MainPage.SoftSmsType };
-                            var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj);
-                            var requestRevertObj = MainPage.RequestHttps (API.YdForgetPassword, requestJson, false);
-                            if (requestRevertObj.StateCode.ToUpper() == "SUCCESS") {
-                                Application.RunOnMainThread (() => {
-                                    this.Close ();
-                                    new Alert ("", "A reset link has been sent to you email ID, Please check.", Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                                    new AccountLogin (emailAccount, "").Show ();
-                                });
-                            } else {
-                                ShowYdForgetPasswordErrorInfo (requestRevertObj.StateCode);
-                            }
-                        }
-                    } catch {
-                        Application.RunOnMainThread (() => {
-                            new Alert ("", Language.StringByID (R.MyInternationalizationString.CheckInternet), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                        });
-                    } finally {
-                        Application.RunOnMainThread (() => {
-                            MainPage.Loading.Hide ();
-                        });
-                    }
-                });
-            };
-        }
-
 
         /// <summary>
-        ///* (1)Success 鍒� [璋冪敤姝ゆ帴鍙f搷浣滄垚鍔焆, ResponseData鍒欎负null<br/>
        ///* (2)ParameterOrEmpty,鍒欏搷搴斿瓧娈典腑 [ErrorInfo] 涓洪敊璇俊鎭�, ResponseData鍒欎负null<br/>
        ///* (3)AccountNoExists,鍒欏搷搴斿瓧娈典腑 [ErrorInfo] 涓洪敊璇俊鎭� [甯愬彿涓嶅瓨鍦�!], ResponseData鍒欎负null<br/> 
        ///* (4)SendEmailFail,鍒欏搷搴斿瓧娈典腑 [ErrorInfo] 涓洪敊璇俊鎭� [鍙戦�侀偖浠跺け璐�!], ResponseData鍒欎负null<br/> 
+        /// 閭蹇樿瀵嗙爜椤甸潰
         /// </summary>
-        /// <param name="stateCodeStr"></param>
-        void ShowYdForgetPasswordErrorInfo (string stateCodeStr)
-        {
-            string mes = "";
-            //2020-01-06 寰呰ˉ鍏�
-            if (stateCodeStr == "AccountNoExists") {
-                mes = ErrorCode.ACCOUNTNOEXISTS;
-            } else if (stateCodeStr == "SendEmailFail") {
-                mes = ErrorCode.SendEmailFail;
-            } else if (stateCodeStr == ErrorCode.NetworkError) {
-                mes = ErrorCode.NetworkError;
-            } else {
-                mes = ErrorCode.OperationFailed + ErrorCode.Reason + stateCodeStr;
-            }
-            if (!string.IsNullOrEmpty (mes)) {
-                Application.RunOnMainThread (() => {
-                    new Alert ("", mes, Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                });
-            }
-
-
-        }
-
-        void PhoneReagistrationView (FrameLayout registrationView)
+        /// <param name="registrationView"></param>
+        void EmailForgotView (FrameLayout registrationView)
         {
             registrationView.RemoveAll ();
-            Button btnPhone = new Button () {
+            Button btnEmail = new Button () {
                 Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
+                Height = Application.GetRealWidth (85),
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight (20),
-                TextID = R.MyInternationalizationString.PhoneNumber,
+                Y = Application.GetRealWidth (20),
+                TextID = R.MyInternationalizationString.EmailAddress,
                 TextAlignment = TextAlignment.CenterLeft,
                 TextSize = 12,
                 TextColor = SkinStyle.Current.TextColor1,
             };
-            registrationView.AddChidren (btnPhone);
+            registrationView.AddChidren (btnEmail);
 
-            FrameLayout phoneNumView = new FrameLayout () {
+            FrameLayout EmailView = new FrameLayout () {
                 Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
+                Height = Application.GetRealWidth (85),
                 Gravity = Gravity.CenterHorizontal,
-                Y = btnPhone.Bottom,
+                Y = btnEmail.Bottom,
                 BorderWidth = 1,
                 Radius = 5,
                 BorderColor = SkinStyle.Current.BorderColor,
                 //Text = "1270166900@qq.com"
             };
-            registrationView.AddChidren (phoneNumView);
+            registrationView.AddChidren (EmailView);
 
-
-            EditText etPhoneNumber = new EditText () {
+            EditText etEmailAddress = new EditText () {
                 TextAlignment = TextAlignment.Center,
                 TextColor = SkinStyle.Current.TextColor1,
+                PlaceholderText = Language.StringByID (R.MyInternationalizationString.EmailAddress),
+                PlaceholderTextColor = SkinStyle.Current.PlaceholderTextColor,
             };
-            phoneNumView.AddChidren (etPhoneNumber);
+            EmailView.AddChidren (etEmailAddress);
 
             Button btnNext = new Button () {
-                Y = phoneNumView.Bottom + Application.GetRealHeight (20),
+                Y = EmailView.Bottom + Application.GetRealWidth (20),
                 Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
+                Height = Application.GetRealWidth (85),
                 Gravity = Gravity.CenterHorizontal,
+                BackgroundColor = SkinStyle.Current.MainColor,
+                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
+                TextID = R.MyInternationalizationString.Send,
+                TextColor = SkinStyle.Current.TextColor1,
                 Radius = 5,
                 BorderColor = SkinStyle.Current.Transparent,
                 BorderWidth = 0,
-                BackgroundColor = SkinStyle.Current.SubtitleView,
-                SelectedBackgroundColor = SkinStyle.Current.MainColor,
-                TextID = R.MyInternationalizationString.Next,
+                TextSize = 18,
                 TextAlignment = TextAlignment.Center,
-                Enable = false,
-                TextColor = SkinStyle.Current.TextColor2,
+                //IsSelected = true
             };
             registrationView.AddChidren (btnNext);
 
-            btnNext.MouseUpEventHandler += (sender, e) => {
-                string phoneNum = etPhoneNumber.Text.Trim ();
-                MainPage.Loading.Start ("Please wait...");
-                System.Threading.Tasks.Task.Run (() => {
-                    try {
-                        var requestObj = new SignPhoneObj () { Phone = phoneNum, Company = MainPage.SoftSmsType };
-                        var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj);
-                        var requestRevertObj = MainPage.RequestHttps ("SignPhone", requestJson);
-                        if (requestRevertObj.StateCode.ToUpper() == "SUCCESS") {
-                            Application.RunOnMainThread (() => {
-                                InitSMSView (phoneNum);
-                                bodyPageView.PageIndex = bodyPageView.ChildrenCount - 1;
-                            });
-                        }
-                    } catch  {
-                        MainPage.FailureToServer ();
-                    } finally {
-                        Application.RunOnMainThread (() => {
-                            MainPage.Loading.Hide ();
-                        });
-                    }
-                });
+            btnNext.MouseDownEventHandler += (sender, e) => {
+                btnNext.IsSelected = true;
             };
 
-            etPhoneNumber.TextChangeEventHandler += (sender, e) => {
-                if (e.Length > 11) {
-                    etPhoneNumber.Text = e.Remove (11);
+            btnNext.MouseUpEventHandler += (sender, e) => {
+                btnNext.IsSelected = false;
+                string account = etEmailAddress.Text.Trim ();
+                if (!CommonUtlis.Current.CheckEmail (account)) {
+                    new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.PleaseCheckEmailAddressCorrectly),
+                                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                     return;
                 }
-                if (e.Length > 6) {
-                    btnNext.IsSelected = btnNext.Enable = true;
-                    Regex reg = new Regex ("^\\d+$");
-                    var mFalg = reg.Match (etPhoneNumber.Text.Trim ());
-                    if (mFalg.Success) {
-                        btnNext.IsSelected = btnNext.Enable = true;
-                    } else {
-                        new Tip () { CloseTime = 3, Text = Language.StringByID (R.MyInternationalizationString.PhoneNumberErorr), Direction = AMPopTipDirection.Down }.Show (etPhoneNumber);
-                    }
-                } else if (e.Length < 6) {
-                    btnNext.IsSelected = btnNext.Enable = false;
-                }
+                //
+                SendVerificationCode (account, false);
             };
+
         }
 
-        void InitSMSView (string mobileNumber)
+        /// <summary>
+        /// 鎵嬫満鎴栬�呴偖绠卞彂閫侀獙璇佺爜骞跺姞杞藉搴旂殑 蹇樿瀵嗙爜椤甸潰
+        /// </summary>
+        /// <param name="account">璐﹀彿 閭鎴栬�呮墜鏈哄彿</param>
+        /// <param name="isPhone">鏄惁鏄墜鏈�</param>
+        void SendVerificationCode (string account, bool isPhone = true)
         {
-            FrameLayout smsChencView = new FrameLayout ();
-            bodyPageView.AddChidren (smsChencView);
-
-            Button btnTitle = new Button () {
-                Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight (50),
-                Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
-                TextID = R.MyInternationalizationString.MobileVerificationCode,
-                TextColor = SkinStyle.Current.TextColor1,
-                TextAlignment = TextAlignment.CenterLeft,
-            };
-            smsChencView.AddChidren (btnTitle);
-
-            EditText etCode = new EditText () {
-                Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
-                Gravity = Gravity.CenterHorizontal,
-                Y = btnTitle.Bottom,
-                BorderWidth = 1,
-                Radius = 5,
-                BorderColor = SkinStyle.Current.BorderColor,
-                TextAlignment = TextAlignment.Center
-                //Text = "1270166900@qq.com"
-            };
-            smsChencView.AddChidren (etCode);
-
-            Button btnNext = new Button () {
-                Y = etCode.Bottom + Application.GetRealHeight (20),
-                Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
-                Gravity = Gravity.CenterHorizontal,
-                Radius = 5,
-                BorderColor = SkinStyle.Current.Transparent,
-                BorderWidth = 0,
-                BackgroundColor = SkinStyle.Current.SubtitleView,
-                SelectedBackgroundColor = SkinStyle.Current.MainColor,
-                TextID = R.MyInternationalizationString.Next,
-                TextAlignment = TextAlignment.Center,
-                Enable = false,
-                TextColor = SkinStyle.Current.TextColor1,
-            };
-            smsChencView.AddChidren (btnNext);
-
-            etCode.TextChangeEventHandler += (sender, e) => {
-                if (e.Length > 6) {
-                    etCode.Text = e.Remove (6);
-                } else if (e.Length == 6) {
-                    btnNext.IsSelected = btnNext.Enable = true;
-                } else {
-                    btnNext.IsSelected = btnNext.Enable = false;
-                }
-            };
-
-            btnNext.MouseUpEventHandler += (sender, e) => {
-                string vCode = etCode.Text.Trim ();
-                MainPage.Loading.Start ("Please wait...");
-                System.Threading.Tasks.Task.Run (() => {
-                    try {
-                        var requestObj = new ValidateSmsCodeObj () { Phone = mobileNumber, Code = vCode };
-                        var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj);
-                        var requestRevertObj = MainPage.RequestHttps ("ValidateSmsCode", requestJson, false);
-                        if (requestRevertObj.StateCode.ToUpper() == "SUCCESS") {
-                            Application.RunOnMainThread (() => {
-                                InitMobilePasswrod (mobileNumber);
-                                bodyPageView.PageIndex = bodyPageView.ChildrenCount - 1;
-                            });
-                        }
-                    } catch {
-                        MainPage.FailureToServer ();
-                    } finally {
+            MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
+            System.Threading.Tasks.Task.Run (() => {
+                try {
+                    var requestRevertObj = HttpServerRequest.Current.VerificationCodeSend (VerifyType.FIND_PASSWORD, account);
+                    if (requestRevertObj.Code.ToUpper () == StateCode.SUCCESS) {
                         Application.RunOnMainThread (() => {
-                            MainPage.Loading.Hide ();
+                            InitSMSView (account, false);
+                            bodyPageView.PageIndex = bodyPageView.ChildrenCount - 1;
                         });
+                    } else {
+                        //鎻愮ず閿欒
+                        IMessageCommon.Current.ShowErrorInfoAlter (requestRevertObj.Code);
                     }
-                });
-            };
+
+                } catch {
+                    MainPage.FailureToServer ();
+                } finally {
+                    Application.RunOnMainThread (() => {
+                        MainPage.Loading.Hide ();
+                    });
+                }
+            });
         }
 
-        void InitMobilePasswrod (string mobileNumber)
+        /// <summary>
+        /// 楠岃瘉楠岃瘉鐮佸苟鎻愪氦娉ㄥ唽
+        /// </summary>
+        /// <param name="mAccount"></param>
+        /// <param name="bPhone"></param>
+        void InitSMSView (string mAccount, bool bPhone = true)
         {
             FrameLayout mobileChencView = new FrameLayout ();
             bodyPageView.AddChidren (mobileChencView);
 
+            Button btnAccount = new Button () {
+                Gravity = Gravity.CenterHorizontal,
+                Y = Application.GetRealHeight (20),
+                Width = Application.GetRealWidth (500),
+                Height = Application.GetRealWidth (50),
+                Text = mAccount,
+                TextColor = SkinStyle.Current.TextColor1,
+                TextAlignment = TextAlignment.Center,
+            };
+            mobileChencView.AddChidren (btnAccount);
+
             Button btnPassword = new Button () {
                 Gravity = Gravity.CenterHorizontal,
-                Y = Application.GetRealHeight (50),
+                Y = btnAccount.Bottom,
                 Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
+                Height = Application.GetRealWidth (85),
                 TextID = R.MyInternationalizationString.Password,
                 TextColor = SkinStyle.Current.TextColor1,
                 TextAlignment = TextAlignment.CenterLeft,
@@ -449,14 +220,15 @@
 
             EditText etPassword = new EditText () {
                 Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
+                Height = Application.GetRealWidth (85),
                 Gravity = Gravity.CenterHorizontal,
                 Y = btnPassword.Bottom,
                 BorderWidth = 1,
                 Radius = 5,
                 BorderColor = SkinStyle.Current.BorderColor,
                 SecureTextEntry = true,
-                TextAlignment = TextAlignment.Center
+                TextAlignment = TextAlignment.Center,
+                TextColor = SkinStyle.Current.TextColor1
                 //Text = "1270166900@qq.com"
             };
             mobileChencView.AddChidren (etPassword);
@@ -464,9 +236,9 @@
 
             Button btnConfrimPassword = new Button () {
                 Gravity = Gravity.CenterHorizontal,
-                Y = etPassword.Bottom + Application.GetRealHeight (20),
+                Y = etPassword.Bottom,
                 Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
+                Height = Application.GetRealWidth (85),
                 TextID = R.MyInternationalizationString.ConfirmPassword,
                 TextColor = SkinStyle.Current.TextColor1,
                 TextAlignment = TextAlignment.CenterLeft,
@@ -475,61 +247,114 @@
 
             EditText etConfrimPassword = new EditText () {
                 Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
+                Height = Application.GetRealWidth (85),
                 Gravity = Gravity.CenterHorizontal,
                 Y = btnConfrimPassword.Bottom,
                 BorderWidth = 1,
                 Radius = 5,
                 BorderColor = SkinStyle.Current.BorderColor,
                 SecureTextEntry = true,
-                TextAlignment = TextAlignment.Center
+                TextAlignment = TextAlignment.Center,
+                TextColor = SkinStyle.Current.TextColor1
             };
             mobileChencView.AddChidren (etConfrimPassword);
 
-            Button btnConfirem = new Button () {
+            Button btnTitle = new Button () {
                 Gravity = Gravity.CenterHorizontal,
-                Y = etConfrimPassword.Bottom + Application.GetRealHeight (50),
+                Y = etConfrimPassword.Bottom,
                 Width = Application.GetRealWidth (500),
-                Height = Application.GetRealHeight (85),
+                Height = Application.GetRealWidth (85),
+                TextID = R.MyInternationalizationString.MobileVerificationCode,
+                TextColor = SkinStyle.Current.TextColor1,
+                TextAlignment = TextAlignment.CenterLeft,
+            };
+            mobileChencView.AddChidren (btnTitle);
+
+            EditText etCode = new EditText () {
+                Width = Application.GetRealWidth (500),
+                Height = Application.GetRealWidth (85),
+                Gravity = Gravity.CenterHorizontal,
+                Y = btnTitle.Bottom,
+                BorderWidth = 1,
+                Radius = 5,
+                BorderColor = SkinStyle.Current.BorderColor,
+                TextAlignment = TextAlignment.Center,
+                TextColor = SkinStyle.Current.TextColor1
+            };
+            mobileChencView.AddChidren (etCode);
+
+            Button btnConfirem = new Button () {
+                Y = etCode.Bottom + Application.GetRealWidth (50),
+                Width = Application.GetRealWidth (500),
+                Height = Application.GetRealWidth (85),
+                Gravity = Gravity.CenterHorizontal,
+                BackgroundColor = SkinStyle.Current.MainColor,
+                SelectedBackgroundColor = SkinStyle.Current.SelectedColor,
                 TextID = R.MyInternationalizationString.Confrim,
                 TextColor = SkinStyle.Current.TextColor1,
+                Radius = 5,
+                BorderColor = SkinStyle.Current.Transparent,
+                BorderWidth = 0,
+                TextSize = 18,
                 TextAlignment = TextAlignment.Center,
-                BackgroundColor = SkinStyle.Current.MainColor
             };
             mobileChencView.AddChidren (btnConfirem);
 
+            etCode.TextChangeEventHandler += (sender, e) => {
+                if (e.Length > 6) {
+                    etCode.Text = e.Remove (6);
+                } else if (e.Length == 6) {
+                    //btnConfirem.IsSelected = btnConfirem.Enable = true;
+                } else {
+                    //btnConfirem.IsSelected = btnConfirem.Enable = false;
+                }
+            };
+
+            btnConfirem.MouseDownEventHandler += (sender, e) => {
+                btnConfirem.IsSelected = true;
+            };
+
             btnConfirem.MouseUpEventHandler += (sender, e) => {
-                if (etPassword.Text.Trim ().Length < 6) {
-                    new Alert ("", Language.StringByID (R.MyInternationalizationString.PasswordLenghtTip),
+                btnConfirem.IsSelected = false;
+                string passwordText = etPassword.Text.Trim ();
+                string confrimPasswordText = etConfrimPassword.Text.Trim ();
+                //妫�娴嬪瘑鐮�
+                if (passwordText == "" && confrimPasswordText == "") {
+                    new Alert ("", Language.StringByID (R.MyInternationalizationString.PleaseWriteTheCompleteContent), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                    return;
+                } else if (!CommonUtlis.Current.CheckPassword (passwordText)) {
+                    new Alert ("", ErrorCode.PasswordStrengthNotMatch,
                                Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                     return;
-                }
-                if (etPassword.Text.Trim () != etConfrimPassword.Text.Trim ()) {
+                } else if (passwordText != confrimPasswordText) {
                     new Alert ("", Language.StringByID (R.MyInternationalizationString.RepeatPasswordsDidNotmatch),
                                Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                     return;
                 }
-                string newpw = etConfrimPassword.Text.Trim ();
-                MainPage.Loading.Start ("Lading...");
-                string passwordText = etPassword.Text.Trim ();
+
+                //妫�娴嬮獙璇佺爜
+                string verCode = etCode.Text.Trim ();
+                if (string.IsNullOrEmpty (verCode)) {
+                    Utlis.ShowTip (Language.StringByID (R.MyInternationalizationString.PlsEntryVerificationCode));
+                    return;
+                }
+
+                MainPage.Loading.Start (Language.StringByID (R.MyInternationalizationString.load));
                 System.Threading.Tasks.Task.Run (() => {
                     try {
-                        var requestObj = new ForgetPasswordActionObj () { Account = mobileNumber, Password = newpw };
-                        var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject (requestObj);
-                        var revertObj = MainPage.RequestHttps ("ForgetPasswordAction", requestJson, false);
-                        if (revertObj.StateCode.ToUpper() == "SUCCESS") {
+                        var requestObj = HttpServerRequest.Current.ForgetPassword (mAccount, passwordText, verCode, bPhone);
+                        if (requestObj.Code == StateCode.SUCCESS) {
                             Application.RunOnMainThread (() => {
-                                new Alert ("", Language.StringByID (R.MyInternationalizationString.ThePerationWasSuccessful),
-                                           Language.StringByID (R.MyInternationalizationString.Close)).Show ();
+                                new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.PasswordModificationSuccess), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                                 Close ();
-                                new AccountLogin (mobileNumber, passwordText).Show ();
+                                new AccountLogin (mAccount, passwordText).Show ();
                             });
+                        } else {
+                            //鎻愮ず閿欒
+                            IMessageCommon.Current.ShowErrorInfoAlter (requestObj.Code);
                         }
                     } catch {
-                        Application.RunOnMainThread (() => {
-                            new Alert ("", Language.StringByID (R.MyInternationalizationString.FailureToServer),
-                                       Language.StringByID (R.MyInternationalizationString.Close)).Show ();
-                        });
+                        MainPage.FailureToServer ();
                     } finally {
                         Application.RunOnMainThread (() => {
                             MainPage.Loading.Hide ();
@@ -538,6 +363,10 @@
                 });
 
             };
+
+
         }
     }
+
+
 }
\ No newline at end of file

--
Gitblit v1.8.0