From 18b93d511dc764b469d7c4a7e755f7274f89cdb4 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期一, 27 四月 2020 17:55:14 +0800
Subject: [PATCH] 2020-4-27-1

---
 ZigbeeApp/Shared/Phone/Login/AccountLogin.cs | 1866 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 1,111 insertions(+), 755 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs b/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs
index 065cd53..368a762 100755
--- a/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs
+++ b/ZigbeeApp/Shared/Phone/Login/AccountLogin.cs
@@ -2,654 +2,877 @@
 using Shared.Common;
 using Shared.Phone.UserView;
 using Shared.Phone.Device.CommonForm;
-
+using Shared.Phone.UserCenter;
+
 namespace Shared.Phone.Login
 {
     /// <summary>
     /// 鐧诲綍鐣岄潰
     /// </summary>
     public class AccountLogin : FrameLayout
-    {
-        #region 鈼� 鍙橀噺____________________________
-        /// <summary>
-        /// 鑳屾櫙瑙嗗浘
-        /// </summary>
-        private FrameLayout midFrameLayout;
-        /// <summary>
-        /// 鎵嬫満閭
-        /// </summary>
-        private PhoneEmailForm phoneEmailForm;
-        /// <summary>
-        /// phoneRowForm
-        /// </summary>
-        private PhoneLoginRowForm phoneRow;
-        /// <summary>
-        /// emailRow
-        /// </summary>
-        private EmailLoginRowForm emailRow;
-        /// <summary>
-        /// phonePwdRow
-        /// </summary>
-        private PwdLoginRowForm phonePwdRow;
-        /// <summary>
-        /// emailPwdRow
-        /// </summary>
-        private PwdLoginRowForm emailPwdRow;
+    {
+        #region 鈻� 鍙橀噺澹版槑___________________________
 
-        /// <summary>
-        /// 璐﹀彿瀵嗙爜fl
-        /// </summary>
-        private FrameLayout accountPwdFL;
-        /// <summary>
-        /// 鐧诲綍閿欒鎻愮ず鎸夐挳
-        /// </summary>
-        private Button loginErrorBtn;
-        /// <summary>
-        /// 蹇樿瀵嗙爜鎸夐挳
-        /// </summary>
-        private Button forgotPasswordBtn;
-        /// <summary>
-        /// 鐧诲綍鎸夐挳
-        /// </summary>
-        private Button loginBtn;
-        /// <summary>
-        /// 楠岃瘉鐮佺櫥褰曟寜閽�
-        /// </summary>
-        private Button loginByCodeBtn;
-        /// <summary>
-        /// 娉ㄥ唽鎸夐挳
-        /// </summary>
-        private Button registerBtn;
-        /// <summary>
-        /// wechat
-        /// </summary>
-        private Button wechatBtn;
-        /// <summary>
-        /// qq
-        /// </summary>
-        private Button qqBtn;
         /// <summary>
-        /// 杈撳叆鐨勭櫥闄嗚处鍙�(閲嶆柊鐧婚檰鏃朵娇鐢�)
+        /// 閿欒鎻愮ず鎺т欢
         /// </summary>
-        private string oldInputAccount = string.Empty;
+        private NormalViewControl btnErrorMsg = null;
+        /// <summary>
+        /// 鏄惁鍚屾剰闅愮鍗忚
+        /// </summary>
+        private bool isAgreePrivacyPolicy = true;
 
         #endregion
+
+        #region 鈻� 鍒濆鍖朹____________________________
 
-        #region 鈼� 鏋勯�犳柟娉昣________________________
-
-        /// <summary>
-        /// 鏋勯�犳柟娉�
-        /// </summary>
-        public AccountLogin()
-        {
-            CommonPage.Instance.IsDrawerLockMode = true;
-            BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
-            Tag = "Login";
-        }
-
-        public override void RemoveFromParent()
-        {
-            base.RemoveFromParent();
-        }
-
-        #endregion
-
-        #region 鈼� 鏄剧ず鐣岄潰_________________________
-
-        /// <summary>
-        /// 鏄剧ず鐣岄潰
-        /// </summary>
-        /// <param name="account">Account.</param>
-        /// <param name="password">Password.</param>
-        public void Show(string account = "", string password = "")
-        {
-            if (Config.Instance.IsLogin)
-            {
-
-            }
-            else
-            {
-                LoginViewShow(account);
-            }
-        }
-
-        /// <summary>
-        /// Logins the view show.
-        /// </summary>
-        /// <param name="account">Account.</param>
-        public void LoginViewShow(string account = "")
-        {
-            //璁剧疆涓�涓嬪垵濮嬪��
-            if (account.Contains("@") == true) { this.oldInputAccount = account; }
-            else { this.oldInputAccount = account; }
-
-            #region midFrameLayout
-            midFrameLayout = new FrameLayout()
-            {
-                Width = LayoutParams.MatchParent,
-                Height = Application.GetRealHeight(CommonPage.AppRealHeight),
-                BackgroundColor =ZigbeeColor.Current.GXCBackgroundColor
-            };
-            AddChidren(midFrameLayout);
-            #endregion
-
-            #region 甯冨眬璐︽埛锛屽瘑鐮侊紝蹇樿瀵嗙爜锛屾敞鍐�  鎵嬫満楠岃瘉鐮佺櫥褰�
-
-            var logoBG = new Button()
-            {
-                Height = Application.GetRealHeight(619),
-                UnSelectedImagePath = "Account/Logo_loginBG.png"
-            };
-            midFrameLayout.AddChidren(logoBG);
-
-            var phoneEmailBGFL = new FrameLayout()
-            {
-                Y = logoBG.Bottom,
-                Height = Application.GetRealHeight(1921),
-                BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor
-            };
-            midFrameLayout.AddChidren(phoneEmailBGFL);
-
-            var logo = new Button()
-            {
-                Width = Application.GetMinRealAverage(184),
-                Height = Application.GetMinRealAverage(184),
-                Y = Application.GetRealHeight(230),
-                UnSelectedImagePath = "Account/Logo_White.png",
-                Gravity = Gravity.CenterHorizontal
-            };
-            midFrameLayout.AddChidren(logo);
-
-            var logoName = new Button()
-            {
-                Y = logo.Bottom,
-                Height = Application.GetRealHeight(69),
-                Width = Application.GetRealWidth(300),
-                Gravity = Gravity.CenterHorizontal,
-                TextID = R.MyInternationalizationString.AppName,
-                TextColor = ZigbeeColor.Current.GXCTextWhiteColor,
-                TextSize=16
-            };
-            midFrameLayout.AddChidren(logoName);
-
-            phoneEmailForm = new PhoneEmailForm();
-            phoneEmailForm.Init(midFrameLayout);
-
-
-            //閿欒鎻愮ずBtn
-            loginErrorBtn = new Button()
-            {
-                X = Application.GetRealWidth(242),
-                Y = Application.GetRealHeight(740),
-                Width = Application.GetRealWidth(700),
-                Height = Application.GetRealHeight(58),
-                TextColor = ZigbeeColor.Current.GXCTextRed,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextSize=CommonFormResouce.TextSize,
-                IsBold=true
-            };
-            midFrameLayout.AddChidren(loginErrorBtn);
-
-            accountPwdFL = new FrameLayout()
-            {
-                Y = Application.GetRealHeight(801),
-                Height = Application.GetRealHeight(553),
-                Width = Application.GetRealWidth(942),
-                Gravity = Gravity.CenterHorizontal,
-                BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
-                Radius = (uint)Application.GetRealHeight(17)
-            };
-            midFrameLayout.AddChidren(accountPwdFL);
-
-            AddPhoneOrEmailFL(accountPwdFL, "Phone");
-
-            forgotPasswordBtn = new Button()
-            {
-                X = Application.GetRealWidth(CommonPage.AppRealWidth - 115 - 250),
-                Y = Application.GetRealHeight(1198),
-                Width = Application.GetRealWidth(250),
-                Height = Application.GetRealHeight(58),
-                TextID = R.MyInternationalizationString.ForgotPWD_1,
-                TextSize = CommonFormResouce.loginTextSize,
-                TextColor = Shared.Common.ZigbeeColor.Current.GXCTextGrayColor,
-                TextAlignment = TextAlignment.CenterRight
-            };
-            midFrameLayout.AddChidren(forgotPasswordBtn);
-
-            loginBtn = new Button()
-            {
-                Y = Application.GetRealHeight(1293),
-                Width = Application.GetRealWidth(688),
-                Height = Application.GetRealHeight(127),
-                Gravity = Gravity.CenterHorizontal,
-                TextID = R.MyInternationalizationString.Login,
-                TextSize = 16,
-                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
-                SelectedTextColor = ZigbeeColor.Current.GXCTextWhiteColor,
-                SelectedBackgroundColor = ZigbeeColor.Current.GXCButtonBlackSelectedColor,
-                BackgroundColor = ZigbeeColor.Current.GXCButtonUnSelectedColor,
-                Radius = (uint)Application.GetRealHeight(127 / 2),
-                Enable = false,
-                IsBold=true
-            };
-            midFrameLayout.AddChidren(loginBtn);
-
-            loginByCodeBtn = new Button()
-            {
-                X=Application.GetRealWidth(98),
-                Y = Application.GetRealHeight(1466),
-                Width = Application.GetRealWidth(300),
-                Height = Application.GetRealHeight(49),
-                TextID = R.MyInternationalizationString.LoginByCode,
-                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextSize = CommonFormResouce.loginTextSize
-            };
-            midFrameLayout.AddChidren(loginByCodeBtn);
-
-            registerBtn = new Button()
-            {
-                X = Application.GetRealWidth(738),
-                Y = Application.GetRealHeight(1466),
-                Width = Application.GetRealWidth(244),
-                Height = Application.GetRealHeight(49),
-                TextID = R.MyInternationalizationString.Register,
-                TextColor = ZigbeeColor.Current.GXCTextGrayColor,
-                TextAlignment = TextAlignment.CenterRight,
-                TextSize = CommonFormResouce.loginTextSize
-            };
-            midFrameLayout.AddChidren(registerBtn);
-
-            wechatBtn = new Button
-            {
-                X = Application.GetRealWidth(395),
-                Y = Application.GetRealHeight(1737),
-                Width = Application.GetMinRealAverage(115),
-                Height = Application.GetMinRealAverage(115),
-                UnSelectedImagePath = "Account/Wechat.png",
-                Gravity=Gravity.CenterHorizontal
-            };
-            midFrameLayout.AddChidren(wechatBtn);
-
-            qqBtn = new Button
-            {
-                X = Application.GetRealWidth(567),
-                Y = Application.GetRealHeight(1737),
-                Width = Application.GetMinRealAverage(115),
-                Height = Application.GetMinRealAverage(115),
-                UnSelectedImagePath = "Account/QQ.png"
-            };
-            //midFrameLayout.AddChidren(qqBtn);
-
-            #endregion
-
-            BindEvent();
-
-            if (account.Contains("@") == true)
-            {
-                SelectPhoneOrEmail_MouseUpEvent(phoneEmailForm.SelectedEmail, null);
-            }
-        }
-
-        #endregion
-
-        #region 鈼� 缁戝畾浜嬩欢_________________________
-
-        /// <summary>
-        /// 缁戝畾鎸夐挳浜嬩欢
-        /// </summary>
-        private void BindEvent()
-        {
-            //閫夋嫨鎵嬫満閭
-            phoneEmailForm.SelectedPhone.MouseUpEventHandler += SelectPhoneOrEmail_MouseUpEvent;
-            phoneEmailForm.SelectedEmail.MouseUpEventHandler += SelectPhoneOrEmail_MouseUpEvent;
-            //鐧诲綍浜嬩欢
-            loginBtn.MouseUpEventHandler += LoginBtnEvent;
-            //鐭俊鐧诲綍
-            loginByCodeBtn.MouseUpEventHandler += LoginByCode;
-            //娉ㄥ唽浜嬩欢
-            registerBtn.MouseUpEventHandler += Register;
-            //蹇樿瀵嗙爜
-            forgotPasswordBtn.MouseUpEventHandler += ForgetPWD_MouseUpEvent;
-            //wechat
-            wechatBtn.MouseUpEventHandler += LoginByWechat;
-            //qq
-            qqBtn.MouseUpEventHandler += LoginByQQ;
-        }
-
-        #endregion
-
-        #region 鈼� 鐧诲綍____________________________
-
-        /// <summary>
-        /// 鐧诲綍浜嬩欢
-        /// </summary>
-        /// <param name="sender">Sender.</param>
-        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
-        private void LoginBtnEvent(object sender,MouseEventArgs mouseEventArgs)
-        {
-            if (phoneEmailForm.SelectedPhone.IsSelected)
-            {
-                Login(phoneRow.AccountET.Text.Trim(), phonePwdRow.PasswrodET.Text.Trim());
-            }
-            else
-            {
-                Login(emailRow.AccountET.Text.Trim(), emailPwdRow.PasswrodET.Text.Trim());
-            }
-
-        }
-
-        /// <summary>
-        /// 鐧诲綍
-        /// </summary>
-        /// <param name="accountStr">Account.</param>
-        /// <param name="passwordStr">Password.</param>
-        private void Login(string accountStr, string passwordStr)
+        /// <summary>
+        /// 鐣岄潰鏄剧ず
+        /// </summary>
+        /// <param name="account">鐧婚檰璐﹀彿</param>
+        public void ShowForm(string account = "")
         {
-            //Application.RunOnMainThread( () =>
-            //{
-            Action action = async () =>
-            {
-                try
-                {
-                    if(CheckAccount(accountStr)==false)
-                    {
-                        return;
-                    }
-
-                    CommonPage.Loading.Start(Language.StringByID(R.MyInternationalizationString.Logining));
+            if (Config.Instance.IsLogin == true)
+            {
+                return;
+            }
+            CommonPage.Instance.IsDrawerLockMode = true;
+            this.Tag = "Login";
 
-                    var requestObj = new SendDataToServer.LoginObj
-                    {
-                        Account = accountStr,
-                        Password = passwordStr,
-                        Source = CommonPage.Source,
-                        Company = CommonPage.Company
-                    };
-                    var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
-                    var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/Login", System.Text.Encoding.UTF8.GetBytes(requestJson));
-                    if (revertObj == null)
-                    {
-                        CommonPage.Instance.FailureToServer();
-                        CommonPage.Loading.Hide();
-                        return;
-                    }
-                    var stateCodeStr = revertObj.StateCode.ToUpper();
-                    //Error 涓嶈兘鐩存帴浠庢湇鍔″櫒鍙栵紝鍙兘鏍规嵁鐘舵�佺爜閫愪竴鍒ゆ柇
-                    if (stateCodeStr == "SUCCESS")
-                    {
-                        if (revertObj.ResponseData == null)
-                        {
-                            return;
-                        }
-
-                        HomePage.Instance.ShowLoginLoadView();
+            //鐣岄潰涓婇儴鐨勯粦鑹插浘鐗�
+            var btnTopBlackPic = new NormalViewControl(this.Width, Application.GetRealHeight(619), false);
+            btnTopBlackPic.UnSelectedImagePath = "Account/Logo_loginBG.png";
+            this.AddChidren(btnTopBlackPic);
 
-                        new System.Threading.Thread(async () =>
-                        {
-                            //瀛樺偍鏁版嵁
-                            var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
-                            var revertData = responseDataObj;
-                            Config.ReFresh();
-                            Config.Instance.Account = revertData.Account;
-                            Config.Instance.Password = passwordStr;
-                            Config.Instance.MD5PWD = revertData.MD5PWD;
-                            Config.Instance.Guid = revertData.Guid;
-                            Config.Instance.LoginDateTime = DateTime.Now;
-                            Config.Instance.LoginToken = revertData.Token;
-                            if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
-                            {
-                                Config.Instance.AccountList.Add(revertData.Account);
-                            }
-                            Config.Instance.Save();
+            //涓棿娴呯櫧鑹茬殑鑳屾櫙
+            var frameMidBack = new FrameLayout();
+            frameMidBack.Y = btnTopBlackPic.Bottom;
+            frameMidBack.Height = this.Height - btnTopBlackPic.Bottom;
+            frameMidBack.BackgroundColor = ZigbeeColor.Current.GXCGrayBackgroundColor;
+            this.AddChidren(frameMidBack);
+
+            //HdlHome鐨勫浘鏍�
+            var btnLogoIcon = new PicViewControl(184, 184);
+            btnLogoIcon.Y = Application.GetRealHeight(230);
+            btnLogoIcon.UnSelectedImagePath = "Account/Logo_White.png";
+            btnLogoIcon.Gravity = Gravity.CenterHorizontal;
+            this.AddChidren(btnLogoIcon);
+            //Hdl Home
+            var btnLogoName = new NormalViewControl(300, 69, true);
+            btnLogoName.Y = btnLogoIcon.Bottom;
+            btnLogoName.Gravity = Gravity.CenterHorizontal;
+            btnLogoName.TextID = R.MyInternationalizationString.AppName;
+            btnLogoName.TextColor = ZigbeeColor.Current.GXCTextWhiteColor;
+            btnLogoName.TextAlignment = TextAlignment.Center;
+            btnLogoName.TextSize = 16;
+            this.AddChidren(btnLogoName);
 
-                            var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
-                            var homes = await House.GetHomeLists();
-                            //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
-                            await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
-                            //鍚姩ZigBee
-                            ZigBee.Common.Application.Init();
+            //1:鎵嬫満鍙�  2锛氶偖绠�
+            int selectIndex = account.Contains("@") == false ? 1 : 2;
 
-                            UserCenter.HdlRoomLogic.Current.InitAllRoom();
-                            Application.RunOnMainThread(() =>
-                            {
-                                CommonPage.Loading.Hide();
-                                this.RemoveFromParent();
-                                CommonPage.Instance.RemoveViewByTag("Login");
-                                UserPage.Instance.Fresh();
-                            });
-                        })
-                        { IsBackground = true }.Start();
-                    }
-                    else if (stateCodeStr == "NOTVERIFY")
-                    {
-                        CommonPage.Loading.Hide();
-                        //鏈縺娲�
-                        loginErrorBtn.TextID = R.MyInternationalizationString.NOTVERIFY;
-                    }
-                    else if (stateCodeStr == "NOTENABLE")
-                    {
-                        CommonPage.Loading.Hide();
-                        //璇ョ敤鎴峰睘浜庤皟璇曡处鍙凤紝骞舵湭鍚敤
-                        loginErrorBtn.TextID = R.MyInternationalizationString.NOTENABLE;
-                    }
-                    else if (stateCodeStr == "USERNAMEORPWDERROR")
-                    {
-                        CommonPage.Loading.Hide();
-                        //璐﹀彿鎴栧瘑鐮侀敊璇�
-                        loginErrorBtn.TextID = R.MyInternationalizationString.USERNAMEORPWDERROR;
-                    }
-                    else if (stateCodeStr == "ACCOUNTNOEXISTS")
-                    {
-                        CommonPage.Loading.Hide();
-                        //璐﹀彿涓嶅瓨鍦�
-                        loginErrorBtn.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
-                    }
-                    else if (stateCodeStr == "YOUDATANOISLOCALREGION")
-                    {
-                        CommonPage.Loading.Hide();
-                        //涓嶅湪鏈尯鍩燂紝闇�瑕侀噸瀹氬悜鍖哄煙鍚庡啀娆¤姹傜櫥褰�
-                        if (revertObj.ResponseData == null)
-                        {
-                            return;
-                        }
-                        var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginLocalRegionRes>(revertObj.ResponseData.ToString());
-                        CommonPage.RequestHttpsHost = responseDataObj.RegionServer;
-                        //鍐嶆鐧诲綍
-                        Login(accountStr, passwordStr);
-                    }
-                    else
-                    {
-                        loginErrorBtn.TextID = R.MyInternationalizationString.RequestServerFailed;
-                    }
+            //鍒濆鍖� 鎵嬫満璐﹀彿鐧婚檰绐楀彛
+            var frameAccLoginPhoneback = this.InitAccoutLoginWindow(frameMidBack, selectIndex == 1 ? account : string.Empty, 1);
+            //鍒濆鍖� 閭璐﹀彿鐧婚檰绐楀彛
+            var frameEmailLoginPhoneback = this.InitAccoutLoginWindow(frameMidBack, selectIndex == 1 ? string.Empty : account, 2);
+            //鍒濆鍖� 鎵嬫満璐﹀彿楠岃瘉鐮佺櫥闄嗙獥鍙�
+            var frameAccCodeLoginPhoneback = this.InitCodeLoginWindow(frameMidBack, selectIndex == 1 ? account : string.Empty, 1);
+            //鍒濆鍖� 閭璐﹀彿楠岃瘉鐮佺櫥闄嗙獥鍙�
+            var frameEmailCodeLoginPhoneback = this.InitCodeLoginWindow(frameMidBack, selectIndex == 1 ? string.Empty : account, 2);
+
+            //瀹氫箟杩欎袱涓笢瑗�,鏄负浜嗗噺灏戝垽鏂殑浠g爜
+            var framePhone = frameAccLoginPhoneback;
+            var frameEmail = frameEmailLoginPhoneback;
+
+            //閭,鎵嬫満鍙风殑鍒囨崲鎺т欢
+            var sitchControl = new Controls.PhoneEmailSelectControl();
+            sitchControl.Y = Application.GetRealHeight(559);
+            this.AddChidren(sitchControl);
+            sitchControl.SelectMenuEvent += (selectMenu) =>
+            {
+                selectIndex = selectMenu;
+                //鎵嬫満鍙�
+                if (selectIndex == 1)
+                {
+                    framePhone.Visible = true;
+                    frameEmail.Visible = false;
                 }
-                catch (Exception ex)
-                {
-                    System.Console.WriteLine($"鐧诲綍澶辫触--{ex.Message}");
-                    CommonPage.Loading.Hide();
-                    CommonPage.Instance.FailureToServer();
-                }
-                finally
-                {
-                    //CommonPage.Loading.Hide();
-                }
-                //});
+                //閭
+                else if (selectIndex == 2)
+                {
+                    framePhone.Visible = false;
+                    frameEmail.Visible = true;
+                }
             };
-            action();
-        }
+            //鎵ц鍒濆鍖�
+            sitchControl.InitControl(ZigbeeColor.Current.GXCButtonSelectedColor, selectIndex);
 
+            //閿欒鎻愮ず鎺т欢
+            this.btnErrorMsg = new NormalViewControl(700, 60, true);
+            btnErrorMsg.Y = frameAccLoginPhoneback.Y - Application.GetRealHeight(60 + 3);
+            btnErrorMsg.X = Application.GetRealWidth(288);
+            btnErrorMsg.TextColor = ZigbeeColor.Current.GXCTextRed;
+            btnErrorMsg.IsBold = true;
+            frameMidBack.AddChidren(btnErrorMsg);
+
+            //楠岃瘉鐮佺櫥闄�
+            //1:璐﹀彿鐧婚檰  2:楠岃瘉鐮佺櫥闄�
+            int codeDiv = 1;
+            var btnLoginByCode = new NormalViewControl(300, 100, true);
+            btnLoginByCode.X = Application.GetRealWidth(98);
+            btnLoginByCode.Y = frameAccLoginPhoneback.Bottom + Application.GetRealHeight(21);
+            btnLoginByCode.TextID = R.MyInternationalizationString.LoginByCode;
+            btnLoginByCode.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnLoginByCode.TextSize = 12;
+            frameMidBack.AddChidren(btnLoginByCode);
+            btnLoginByCode.ButtonClickEvent += (sender, e) =>
+            {
+                if (codeDiv == 1)
+                {
+                    //楠岃瘉鐮佺櫥闄�
+                    codeDiv = 2;
+                    btnLoginByCode.TextID = R.MyInternationalizationString.LoginByAccountPWD; //璐﹀彿鐧婚檰
+                    //璐﹀彿鐧婚檰鐨勪袱涓笢瑗块殣钘�
+                    frameAccLoginPhoneback.Visible = false;
+                    frameEmailLoginPhoneback.Visible = false;
+                    //鏇挎崲杩欎袱涓笢瑗�
+                    framePhone = frameAccCodeLoginPhoneback;
+                    frameEmail = frameEmailCodeLoginPhoneback;
+                }
+                else
+                {
+                    //璐﹀彿鐧婚檰
+                    codeDiv = 1;
+                    btnLoginByCode.TextID = R.MyInternationalizationString.LoginByCode;//楠岃瘉鐮佺櫥闄�
+                    //楠岃瘉鐮佺櫥闄嗙殑涓や釜涓滆タ闅愯棌
+                    frameAccCodeLoginPhoneback.Visible = false;
+                    frameEmailCodeLoginPhoneback.Visible = false;
+                    //鏇挎崲杩欎袱涓笢瑗�
+                    framePhone = frameAccLoginPhoneback;
+                    frameEmail = frameEmailLoginPhoneback;
+                }
+                //鍒锋柊鑿滃崟
+                sitchControl.SetSelectIndex(1);
+            };
+
+            //娉ㄥ唽鐢ㄦ埛
+            var btnRegister = new NormalViewControl(300, 100, true);
+            btnRegister.Y = btnLoginByCode.Y;
+            btnRegister.X = frameMidBack.Width - Application.GetRealWidth(98 + 300);
+            btnRegister.TextID = R.MyInternationalizationString.Register;
+            btnRegister.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnRegister.TextSize = 12;
+            btnRegister.TextAlignment = TextAlignment.CenterRight;
+            frameMidBack.AddChidren(btnRegister);
+            btnRegister.ButtonClickEvent += (sender, e) =>
+            {
+                var registerPage = new AccountRegister();
+                CommonPage.Instance.AddChidren(registerPage);
+                registerPage.Show();
+            };
+
+            //寰俊鍥炬爣
+            var btnWebChat = new IconViewControl(115);
+            btnWebChat.Y = frameMidBack.Height - Application.GetRealHeight(69) - btnWebChat.IconSize;
+            btnWebChat.UnSelectedImagePath = "Account/Wechat.png";
+            btnWebChat.Gravity = Gravity.CenterHorizontal;
+            frameMidBack.AddChidren(btnWebChat);
+            btnWebChat.ButtonClickEvent += (sender, e) =>
+            {
+                //寰俊鐧婚檰
+                this.LoginByWechat();
+            };
+
+            //娣诲姞鏈嶅姟鍗忚鎺т欢
+            //this.AddServiceAgreementControl(frameMidBack);
+
+            //娓稿浣撻獙
+            var btnTiyan = new NormalViewControl(300, 100, true);
+            btnTiyan.Y = btnLoginByCode.Y;
+            btnTiyan.TextAlignment = TextAlignment.Center;
+            btnTiyan.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnTiyan.TextSize = 12;
+            btnTiyan.Gravity = Gravity.CenterHorizontal;
+            btnTiyan.Text = "娓稿浣撻獙";
+            frameMidBack.AddChidren(btnTiyan);
+            btnTiyan.ButtonClickEvent += (sender, e) =>
+            {
+                btnTiyan.CanClick = false;
+                //鏄剧ず鍚姩椤�
+                HomePage.Instance.ShowLoginLoadView();
+                HdlThreadLogic.Current.RunThread(() =>
+                {
+                    //鍒濆鍖栧叏閮ㄤ綋楠屾暟鎹�
+                    HdlExperienceAccountLogic.Current.InitAllExperienceData();
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        this.RemoveFromParent();
+                        CommonPage.Instance.RemoveViewByTag("Login");
+                        UserPage.Instance.Fresh();
+                    });
+                });
+            };
+        }
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖栬处鍙风櫥闄嗙獥鍙________________
+
+        /// <summary>
+        /// 鍒濆鍖栬处鍙风櫥闄嗙獥鍙�
+        /// </summary>
+        /// <param name="frameMidBack">涓棿娴呰壊鐨勮儗鏅鍣�</param>
+        /// <param name="i_account">鐧婚檰璐﹀彿</param>
+        /// <param name="i_div">1:鎵嬫満鍙� 2:閭</param>
+        private FrameLayout InitAccoutLoginWindow(FrameLayout frameMidBack, string i_account, int i_div)
+        {
+            //鐧婚檰鎸夐挳
+            BottomClickButton btnLogin = null;
+            //璐﹀彿杈撳叆妗�
+            TextInputControl txtAccount = null;
+            //瀵嗙爜杈撳叆妗�
+            TextInputControl txtPsw = null;
+            //瀹瑰櫒
+            var frameBack = new FrameLayout();
+            frameBack.Height = Application.GetRealHeight(620);
+            frameBack.Y = Application.GetRealHeight(181);
+            frameMidBack.AddChidren(frameBack);
+            frameBack.Visible = false;
+            //鐧借壊鑳屾櫙
+            var frameWhiteBack = new FrameLayout();
+            frameWhiteBack.Width = Application.GetRealWidth(942);
+            frameWhiteBack.Height = Application.GetRealHeight(553);
+            frameWhiteBack.BackgroundColor = UserCenterColor.Current.White;
+            frameWhiteBack.Radius = (uint)Application.GetRealHeight(17);
+            frameWhiteBack.Gravity = Gravity.CenterHorizontal;
+            frameBack.AddChidren(frameWhiteBack);
+
+            //璐﹀彿琛�
+            var rowAccount = new FrameLayout();
+            rowAccount.Y = Application.GetRealHeight(29);
+            rowAccount.Width = Application.GetRealWidth(884);
+            rowAccount.Height = Application.GetRealHeight(138);
+            rowAccount.Gravity = Gravity.CenterHorizontal;
+            frameWhiteBack.AddChidren(rowAccount);
+            //璐﹀彿鍥炬爣
+            var btnAccountIcon = new IconViewControl(92);
+            btnAccountIcon.X = Application.GetRealWidth(69);
+            btnAccountIcon.Gravity = Gravity.CenterVertical;
+            btnAccountIcon.UnSelectedImagePath = "Account/Account.png";
+            rowAccount.AddChidren(btnAccountIcon);
+            //璐﹀彿杈撳叆妗�
+            txtAccount = new TextInputControl(600, 92, true);
+            txtAccount.X = btnAccountIcon.Right + Application.GetRealWidth(35);
+            txtAccount.Gravity = Gravity.CenterVertical;
+            if (i_div == 1)
+            {
+                //鎵嬫満鍙�
+                txtAccount.IsNumberKeyboardType = true;
+                txtAccount.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPhoneNum);
+            }
+            else
+            {
+                //閭
+                txtAccount.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputEmail);
+            }
+            txtAccount.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
+            txtAccount.Text = i_account;
+            rowAccount.AddChidren(txtAccount);
+            txtAccount.TextChangeEventHandler += (sender, e) =>
+            {
+                //闅愯棌閿欒鎻愮ず
+                this.btnErrorMsg.Text = string.Empty;
+                if (txtAccount.Text.Trim().Length > 0 && txtPsw.Text.Length > 0)
+                {
+                    //鑳藉鐧婚檰
+                    if (btnLogin.CanClick == false) { btnLogin.CanClick = true; }
+                    return;
+                }
+                //涓嶈兘鐐瑰嚮
+                if (btnLogin.CanClick == true) { btnLogin.CanClick = false; }
+            };
+
+            //搴曠嚎
+            var btnAccountLine = new NormalViewControl(rowAccount.Width, 1, false);
+            btnAccountLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+            btnAccountLine.Y = rowAccount.Height - 2;
+            rowAccount.AddChidren(btnAccountLine);
+            txtAccount.FoucsChanged += (sender, focusEvent) =>
+            {
+                //鐒︾偣杩涘叆鏃�,搴曠嚎棰滆壊鍙樻洿
+                if (focusEvent.Focus)
+                {
+                    btnAccountLine.BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor;
+                    btnAccountLine.Height = 2;
+                }
+                else
+                {
+                    btnAccountLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+                    btnAccountLine.Height = 1;
+                }
+            };
+
+            //瀵嗙爜琛�
+            var rowPassword = new FrameLayout();
+            rowPassword.Y = rowAccount.Bottom + Application.GetRealHeight(58);
+            rowPassword.Width = rowAccount.Width;
+            rowPassword.Height = rowAccount.Height;
+            rowPassword.Gravity = Gravity.CenterHorizontal;
+            frameWhiteBack.AddChidren(rowPassword);
+            //璐﹀彿鍥炬爣
+            var btnPswIcon = new IconViewControl(92);
+            btnPswIcon.X = btnAccountIcon.X;
+            btnPswIcon.Gravity = Gravity.CenterVertical;
+            btnPswIcon.UnSelectedImagePath = "Account/Password.png";
+            rowPassword.AddChidren(btnPswIcon);
+            //瀵嗙爜杈撳叆妗�
+            txtPsw = new TextInputControl(600, 92, true);
+            txtPsw.X = txtAccount.X;
+            txtPsw.Gravity = Gravity.CenterVertical;
+            txtPsw.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPWD);
+            txtPsw.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
+            txtPsw.SecureTextEntry = true;
+            rowPassword.AddChidren(txtPsw);
+            txtPsw.TextChangeEventHandler += (sender, e) =>
+            {
+                txtAccount.TextChangeEventHandler(sender, e);
+            };
+            //闅愯棌鎴栬�呮樉绀哄瘑鐮佺殑鍥炬爣
+            var btnHiden = new IconViewControl(92);
+            btnHiden.X = rowPassword.Width - Application.GetRealWidth(46) - btnHiden.IconSize;
+            btnHiden.SelectedImagePath = "Account/UnhidePwd.png";
+            btnHiden.UnSelectedImagePath = "Account/HidePwd.png";
+            btnHiden.Gravity = Gravity.CenterVertical;
+            rowPassword.AddChidren(btnHiden);
+            btnHiden.ButtonClickEvent += (sender, e) =>
+            {
+                txtPsw.SecureTextEntry = !txtPsw.SecureTextEntry;
+                btnHiden.IsSelected = !btnHiden.IsSelected;
+            };
+
+            //搴曠嚎
+            var btnPswLine = new NormalViewControl(rowPassword.Width, 1, false);
+            btnPswLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+            btnPswLine.Y = rowPassword.Height - 2;
+            rowPassword.AddChidren(btnPswLine);
+            txtPsw.FoucsChanged += (sender, focusEvent) =>
+            {
+                //鐒︾偣杩涘叆鏃�,搴曠嚎棰滆壊鍙樻洿
+                if (focusEvent.Focus)
+                {
+                    btnPswLine.BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor;
+                    btnPswLine.Height = 2;
+                }
+                else
+                {
+                    btnPswLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+                    btnPswLine.Height = 1;
+                }
+            };
+
+            //蹇樿瀵嗙爜?
+            var btnForgot = new NormalViewControl(250, 90, true);
+            btnForgot.Y = rowPassword.Bottom + Application.GetRealHeight(15);
+            btnForgot.X = frameWhiteBack.Width - Application.GetRealWidth(250 + 35);
+            btnForgot.TextSize = 12;
+            btnForgot.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnForgot.TextAlignment = TextAlignment.CenterRight;
+            btnForgot.TextID = R.MyInternationalizationString.ForgotPWD_1;
+            frameWhiteBack.AddChidren(btnForgot);
+            btnForgot.ButtonClickEvent += (sender, e) =>
+            {
+                var forgot = new AccountForgetPWD();
+                CommonPage.Instance.AddChidren(forgot);
+                forgot.Show();
+            };
+
+            //鐧婚檰鎸夐挳
+            btnLogin = new BottomClickButton(688);
+            btnLogin.Gravity = Gravity.BottomCenter;
+            btnLogin.TextID = R.MyInternationalizationString.Login;
+            btnLogin.oldBackgroundColor = btnLogin.BackgroundColor;
+            frameBack.AddChidren(btnLogin);
+            btnLogin.CanClick = false;
+            btnLogin.ButtonClickEvent += (sender, e) =>
+            {
+                //璐﹀彿瀵嗙爜鐧婚檰
+                this.LoginByAccountAndPsw(txtAccount.Text.Trim(), txtPsw.Text, i_div);
+            };
+
+            return frameBack;
+        }
+
+        #endregion
+
+        #region 鈻� 鍒濆鍖栭獙璇佺爜鐧婚檰绐楀彛_______________
+
+        /// <summary>
+        /// 鍒濆鍖栭獙璇佺爜鐧婚檰绐楀彛
+        /// </summary>
+        /// <param name="frameMidBack">涓棿娴呰壊鐨勮儗鏅鍣�</param>
+        /// <param name="i_account">鐧婚檰璐﹀彿</param>
+        /// <param name="i_div">1:鎵嬫満鍙� 2:閭</param>
+        private FrameLayout InitCodeLoginWindow(FrameLayout frameMidBack, string i_account, int i_div)
+        {
+            //鐧婚檰鎸夐挳
+            BottomClickButton btnLogin = null;
+            //璐﹀彿杈撳叆妗�
+            TextInputControl txtAccount = null;
+            //瀵嗙爜杈撳叆妗�
+            TextInputControl txtVerCode = null;
+            //褰撳墠杈撳叆鐨勮处鍙�(闃叉鍙戦�侀獙璇佺爜涔嬪悗,淇敼璐﹀彿)
+            string nowInputAccount = string.Empty;
+            //鏄惁宸茬粡鍙戦�佷簡楠岃瘉鐮�
+            bool hadSendCode = false;
+
+            //瀹瑰櫒
+            var frameBack = new FrameLayout();
+            frameBack.Height = Application.GetRealHeight(620);
+            frameBack.Y = Application.GetRealHeight(181);
+            frameMidBack.AddChidren(frameBack);
+            frameBack.Visible = false;
+            //鐧借壊鑳屾櫙
+            var frameWhiteBack = new FrameLayout();
+            frameWhiteBack.Width = Application.GetRealWidth(942);
+            frameWhiteBack.Height = Application.GetRealHeight(553);
+            frameWhiteBack.BackgroundColor = UserCenterColor.Current.White;
+            frameWhiteBack.Radius = (uint)Application.GetRealHeight(17);
+            frameWhiteBack.Gravity = Gravity.CenterHorizontal;
+            frameBack.AddChidren(frameWhiteBack);
+
+            //璐﹀彿琛�
+            var rowAccount = new FrameLayout();
+            rowAccount.Y = Application.GetRealHeight(29);
+            rowAccount.Width = Application.GetRealWidth(884);
+            rowAccount.Height = Application.GetRealHeight(138);
+            rowAccount.Gravity = Gravity.CenterHorizontal;
+            frameWhiteBack.AddChidren(rowAccount);
+            if (i_div == 2)
+            {
+                //璐﹀彿鍥炬爣
+                var btnAccountIcon = new IconViewControl(92);
+                btnAccountIcon.X = Application.GetRealWidth(69);
+                btnAccountIcon.Gravity = Gravity.CenterVertical;
+                btnAccountIcon.UnSelectedImagePath = "Account/Account.png";
+                rowAccount.AddChidren(btnAccountIcon);
+            }
+            else
+            {
+                //鍦板尯鐮�
+                var btnArea = new NormalViewControl(139, 60, true);
+                btnArea.TextColor = UserCenterColor.Current.TextGrayColor1;
+                btnArea.TextAlignment = TextAlignment.CenterRight;
+                btnArea.Text = "+86";
+                btnArea.Gravity = Gravity.CenterVertical;
+                rowAccount.AddChidren(btnArea);
+            }
+            //璐﹀彿杈撳叆妗�
+            txtAccount = new TextInputControl(600, 92, true);
+            txtAccount.X = Application.GetRealWidth(193);
+            txtAccount.Gravity = Gravity.CenterVertical;
+            if (i_div == 1)
+            {
+                //鎵嬫満鍙�
+                txtAccount.IsNumberKeyboardType = true;
+                txtAccount.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputPhoneNum);
+            }
+            else
+            {
+                //閭
+                txtAccount.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputEmail);
+            }
+            txtAccount.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
+            txtAccount.Text = i_account;
+            rowAccount.AddChidren(txtAccount);
+            txtAccount.TextChangeEventHandler += (sender, e) =>
+            {
+                //闅愯棌閿欒鎻愮ず
+                this.btnErrorMsg.Text = string.Empty;
+                //蹇呴』瑕佸彂閫佹垚鍔熸墠琛�
+                if (hadSendCode == true && txtAccount.Text.Trim().Length > 0 && txtVerCode.Text.Length > 0)
+                {
+                    //鑳藉鐧婚檰
+                    if (btnLogin.CanClick == false) { btnLogin.CanClick = true; }
+                    return;
+                }
+                //涓嶈兘鐐瑰嚮
+                if (btnLogin.CanClick == true) { btnLogin.CanClick = false; }
+            };
+            //搴曠嚎
+            var btnAccountLine = new NormalViewControl(rowAccount.Width, 1, false);
+            btnAccountLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+            btnAccountLine.Y = rowAccount.Height - 2;
+            rowAccount.AddChidren(btnAccountLine);
+            txtAccount.FoucsChanged += (sender, focusEvent) =>
+            {
+                //鐒︾偣杩涘叆鏃�,搴曠嚎棰滆壊鍙樻洿
+                if (focusEvent.Focus)
+                {
+                    btnAccountLine.BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor;
+                    btnAccountLine.Height = 2;
+                }
+                else
+                {
+                    btnAccountLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+                    btnAccountLine.Height = 1;
+                }
+            };
+
+            //楠岃瘉鐮佽
+            var rowVerCode = new FrameLayout();
+            rowVerCode.Y = rowAccount.Bottom + Application.GetRealHeight(58);
+            rowVerCode.Width = rowAccount.Width;
+            rowVerCode.Height = rowAccount.Height;
+            rowVerCode.Gravity = Gravity.CenterHorizontal;
+            frameWhiteBack.AddChidren(rowVerCode);
+            //璐﹀彿鍥炬爣
+            var btnCodeIcon = new IconViewControl(92);
+            btnCodeIcon.X = Application.GetRealWidth(69);
+            btnCodeIcon.Gravity = Gravity.CenterVertical;
+            btnCodeIcon.UnSelectedImagePath = "Account/Code.png";
+            rowVerCode.AddChidren(btnCodeIcon);
+            //楠岃瘉鐮佽緭鍏ユ
+            txtVerCode = new TextInputControl(350, 92, true);
+            txtVerCode.X = btnCodeIcon.Right + Application.GetRealWidth(35);
+            txtVerCode.Gravity = Gravity.CenterVertical;
+            txtVerCode.PlaceholderText = Language.StringByID(R.MyInternationalizationString.PleaseInputVerificationCode);
+            txtVerCode.PlaceholderTextColor = ZigbeeColor.Current.GXCPlaceHolderTextColor;
+            rowVerCode.AddChidren(txtVerCode);
+            txtVerCode.TextChangeEventHandler += (sender, e) =>
+            {
+                txtAccount.TextChangeEventHandler(sender, e);
+            };
+            //绔栫嚎
+            var btnLine2 = new NormalViewControl(1, Application.GetRealHeight(66), false);
+            btnLine2.X = Application.GetRealWidth(611);
+            btnLine2.Gravity = Gravity.CenterVertical;
+            btnLine2.BackgroundColor = ZigbeeColor.Current.GXCLineColor;
+            rowVerCode.AddChidren(btnLine2);
+            //鑾峰彇楠岃瘉鐮�
+            var btnSendCode = new NormalViewControl(250, 70, true);
+            btnSendCode.X = btnLine2.Right + Application.GetRealWidth(36);
+            btnSendCode.Gravity = Gravity.CenterVertical;
+            btnSendCode.TextID = R.MyInternationalizationString.SendVerificationCode;
+            btnSendCode.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnSendCode.TextAlignment = TextAlignment.Center;
+            btnSendCode.IsBold = true;
+            rowVerCode.AddChidren(btnSendCode);
+            btnSendCode.ButtonClickEvent += async (sender, e) =>
+            {
+                //妫�娴嬭緭鍏ョ殑璐﹀彿
+                nowInputAccount = txtAccount.Text.Trim();
+                if (this.CheckInputAccount("86", nowInputAccount, i_div) == false)
+                {
+                    return;
+                }
+                //鍙戦�侀獙璇佺爜
+                hadSendCode = await this.SendVerCode(btnSendCode, nowInputAccount, i_div);
+            };
+
+            //搴曠嚎
+            var btnCodeLine = new NormalViewControl(rowVerCode.Width, 1, false);
+            btnCodeLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+            btnCodeLine.Y = rowVerCode.Height - 2;
+            rowVerCode.AddChidren(btnCodeLine);
+            txtVerCode.FoucsChanged += (sender, focusEvent) =>
+            {
+                //鐒︾偣杩涘叆鏃�,搴曠嚎棰滆壊鍙樻洿
+                if (focusEvent.Focus)
+                {
+                    btnCodeLine.BackgroundColor = ZigbeeColor.Current.GXCSelectedLineColor;
+                    btnCodeLine.Height = 2;
+                }
+                else
+                {
+                    btnCodeLine.BackgroundColor = ZigbeeColor.Current.GXCGrayLineColor;
+                    btnCodeLine.Height = 1;
+                }
+            };
+
+            //蹇樿瀵嗙爜?
+            var btnForgot = new NormalViewControl(250, 90, true);
+            btnForgot.Y = rowVerCode.Bottom + Application.GetRealHeight(15);
+            btnForgot.X = frameWhiteBack.Width - Application.GetRealWidth(250 + 35);
+            btnForgot.TextSize = 12;
+            btnForgot.TextColor = UserCenterColor.Current.TextGrayColor3;
+            btnForgot.TextAlignment = TextAlignment.CenterRight;
+            btnForgot.TextID = R.MyInternationalizationString.ForgotPWD_1;
+            frameWhiteBack.AddChidren(btnForgot);
+            btnForgot.ButtonClickEvent += (sender, e) =>
+            {
+                var forgot = new AccountForgetPWD();
+                CommonPage.Instance.AddChidren(forgot);
+                forgot.Show();
+            };
+
+            //鐧婚檰鎸夐挳
+            btnLogin = new BottomClickButton(688);
+            btnLogin.Gravity = Gravity.BottomCenter;
+            btnLogin.TextID = R.MyInternationalizationString.Login;
+            btnLogin.oldBackgroundColor = btnLogin.BackgroundColor;
+            frameBack.AddChidren(btnLogin);
+            btnLogin.CanClick = false;
+            btnLogin.ButtonClickEvent += (sender, e) =>
+            {
+                //楠岃瘉鐮佺櫥闄�
+                this.LoginByVerCode(nowInputAccount, txtVerCode.Text.Trim(), i_div);
+            };
+            return frameBack;
+        }
+
+        #endregion
+
+        #region 鈻� 鏈嶅姟鍗忚___________________________
+
+        /// <summary>
+        /// 娣诲姞鏈嶅姟鍗忚鎺т欢
+        /// </summary>
+        /// <param name="frameBack"></param>
+        private void AddServiceAgreementControl(FrameLayout frameBack)
+        {
+            var frameRow = new FrameLayout();
+            frameRow.Height = Application.GetMinRealAverage(110);
+            frameRow.Y = Application.GetRealHeight(959);
+            frameRow.Gravity = Gravity.CenterHorizontal;
+
+            //瀛椾綋鎬诲搴�
+            int fontWidth = 0;
+            int btnWidth = 0;
+#if Android
+            //鐗规畩鐨勮宸��
+            int speceilValue = Application.GetRealWidth(20);
+#endif
+#if iOS
+            //鐗规畩鐨勮宸��
+            int speceilValue = Application.GetRealWidth(10);
+#endif
+            //鎴戝凡闃呰骞跺悓鎰�
+            var btnMsg1 = new NormalViewControl(100, 90, true);
+            btnMsg1.Gravity = Gravity.CenterVertical;
+            btnMsg1.Y = Application.GetRealHeight(968);
+            btnMsg1.TextSize = 12;
+            btnMsg1.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnMsg1.TextID = R.MyInternationalizationString.uMyHadReadAndAgree;
+            //璁$畻鐪熷疄瀹藉害
+            btnWidth = btnMsg1.GetRealWidthByText();
+            btnMsg1.Width = btnWidth;
+            fontWidth += btnWidth;
+
+            //銆婇殣绉佹潈鏀跨瓥銆�
+            var btnMsg2 = new NormalViewControl(100, 90, true);
+            btnMsg2.Gravity = Gravity.CenterVertical;
+            btnMsg2.TextSize = 12;
+            btnMsg2.TextColor = 0xFF4A90E2;
+            btnMsg2.Text = "銆�" + Language.StringByID(R.MyInternationalizationString.uPrivacyPolicy) + "銆�";
+            //璁$畻鐪熷疄瀹藉害
+            btnWidth = btnMsg2.GetRealWidthByText();
+            btnMsg2.Width = btnWidth;
+            fontWidth += btnWidth;
+            btnMsg2.ButtonClickEvent += (sender, e) =>
+            {
+                var form = new UserCenter.Abount.SLAForm();
+                this.AddChidren(form);
+                form.InitTopFrameLayout();
+                form.InitBodyFrameLayout();
+                form.ShowForm();
+            };
+
+            //鍜�
+            var btnMsg3 = new NormalViewControl(100, 90, true);
+            btnMsg3.Gravity = Gravity.CenterVertical;
+            btnMsg3.TextSize = 12;
+            btnMsg3.TextColor = UserCenterColor.Current.TextGrayColor1;
+            btnMsg3.TextID = R.MyInternationalizationString.uAnd;
+            //璁$畻鐪熷疄瀹藉害
+            btnWidth = btnMsg3.GetRealWidthByText();
+            btnMsg3.Width = btnWidth;
+            fontWidth += btnWidth;
+
+            //銆婃湇鍔℃潯娆俱��
+            var btnMsg4 = new NormalViewControl(100, 90, true);
+            btnMsg4.Gravity = Gravity.CenterVertical;
+            btnMsg4.TextSize = 12;
+            btnMsg4.TextColor = 0xFF4A90E2;
+            btnMsg4.Text = "銆�" + Language.StringByID(R.MyInternationalizationString.uTermsOfService) + "銆�";
+            //璁$畻鐪熷疄瀹藉害
+            btnWidth = btnMsg4.GetRealWidthByText();
+            btnMsg4.Width = btnWidth;
+            fontWidth += btnWidth;
+            btnMsg4.ButtonClickEvent += (sender, e) =>
+            {
+                btnMsg2.ButtonClickEvent(null, null);
+            };
+
+            //鍥炬爣
+            var btnIcon = new IconBigViewControl(42, 42);
+            btnIcon.UnSelectedImagePath = "Item/Check1.png";
+            btnIcon.SelectedImagePath = "Item/Check1Selected.png";
+
+            //璁$畻琛屾帶浠剁殑瀹藉害
+            frameRow.Width = fontWidth + Application.GetMinRealAverage(42) + Application.GetRealWidth(23) - speceilValue * 3;
+            frameBack.AddChidren(frameRow);
+
+            //鍥炬爣鎺т欢鍒濆鍖�
+            frameRow.AddChidren(btnIcon);
+            btnIcon.InitControl();
+            btnIcon.X = -btnIcon.XOffset;
+            btnIcon.UseClickStatu = false;
+            btnIcon.ButtonClickEvent += (sender, e) =>
+            {
+                btnIcon.IsSelected = !btnIcon.IsSelected;
+                isAgreePrivacyPolicy = btnIcon.IsSelected;
+            };
+
+            btnMsg1.X = btnIcon.btnIcon.Width + Application.GetRealWidth(23);
+            frameRow.AddChidren(btnMsg1);
+            btnMsg2.Y = btnMsg1.Y;
+            btnMsg2.X = btnMsg1.Right - speceilValue;
+            frameRow.AddChidren(btnMsg2);
+            btnMsg3.X = btnMsg2.Right - speceilValue;
+            btnMsg3.Y = btnMsg1.Y;
+            frameRow.AddChidren(btnMsg3);
+            btnMsg4.X = btnMsg3.Right - speceilValue;
+            btnMsg4.Y = btnMsg1.Y;
+            frameRow.AddChidren(btnMsg4);
+        }
+
+        #endregion
+
+        #region 鈻� 璐﹀彿瀵嗙爜鐧婚檰_______________________
+
+        /// <summary>
+        /// 璐﹀彿瀵嗙爜鐧婚檰
+        /// </summary>
+        /// <param name="i_account">璐﹀彿</param>
+        /// <param name="i_psw">瀵嗙爜</param>
+        /// <param name="i_div">1:鎵嬫満鍙� 2:閭</param>
+        private void LoginByAccountAndPsw(string i_account, string i_psw, int i_div)
+        {
+            //妫�娴嬭处鍙�
+            if (this.CheckInputAccount(string.Empty, i_account, i_div) == false)
+            {
+                return;
+            }
+
+            //鐧婚檰涓�....
+            CommonPage.Loading.Start(Language.StringByID(R.MyInternationalizationString.Logining));
+
+            HdlThreadLogic.Current.RunThread(async () =>
+            {
+                //鐧婚檰鍙傛暟
+                var pra = new SendDataToServer.LoginObj();
+                pra.Account = i_account;
+                pra.Password = i_psw;
+                pra.Source = CommonPage.Source;
+                pra.Company = CommonPage.Company;
+
+                //璁块棶鎺ュ彛
+                var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(pra);
+                var result = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/Login", System.Text.Encoding.UTF8.GetBytes(requestJson));
+
+                //澶勭悊鐧婚檰鎴愬姛鐨勬暟鎹�
+                this.AdjustLoginSuccessData(result, pra, i_account, i_psw, i_div);
+            });
+        }
+
         /// <summary>
-        /// CheckAccount
+        /// 妫�娴嬭緭鍏ョ殑璐﹀彿
         /// </summary>
-        /// <param name="accountStr"></param>
+        /// <param name="i_areaCode">鍦板尯鐮�</param>
+        /// <param name="i_account">璐﹀彿</param>
+        /// <param name="i_div">1:鎵嬫満鍙� 2:閭</param>
         /// <returns></returns>
-        private bool CheckAccount(string accountStr)
+        private bool CheckInputAccount(string i_areaCode, string i_account, int i_div)
         {
-            if (phoneEmailForm.SelectedEmail.IsSelected)
-            {
-                if (AccountLogic.Instance.CheckEmail(accountStr) == false)
+            if (i_div == 1)
+            {
+                //妫�娴嬫墜鏈�
+                if (i_areaCode != string.Empty && AccountLogic.Instance.CheckPhoneWithZone(i_account, i_areaCode) == false)
                 {
-                    loginErrorBtn.TextID = R.MyInternationalizationString.TheEmailError;
+                    btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError;
                     return false;
-                }
+                }
+                //妫�娴嬫墜鏈�
+                if (i_areaCode == string.Empty && AccountLogic.Instance.CheckPhone(i_account) == false)
+                {
+                    btnErrorMsg.TextID = R.MyInternationalizationString.ThePhoneError;
+                    return false;
+                }
             }
             else
-            {
-                if (AccountLogic.Instance.CheckPhone(accountStr) == false)
+            {
+                //妫�娴嬮偖绠�
+                if (AccountLogic.Instance.CheckEmail(i_account) == false)
                 {
-                    loginErrorBtn.TextID = R.MyInternationalizationString.ThePhoneError;
+                    btnErrorMsg.TextID = R.MyInternationalizationString.TheEmailError;
                     return false;
-                }
+                }
             }
             return true;
-        }
-
-        /// <summary>
-        /// 閫氳繃楠岃瘉鐮佺櫥褰�
-        /// </summary>
-        /// <param name="sender">Sender.</param>
-        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
-        private void LoginByCode(object sender,MouseEventArgs mouseEventArgs)
-        {
-            //this.RemoveFromParent();
-            var loginByCodePage = new AccountLoginByCode();
-            CommonPage.Instance.AddChidren(loginByCodePage);
-            loginByCodePage.Show();
-        }
-
-        /// <summary>
-        /// wechat鐧诲綍
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="mouseEventArgs"></param>
-        private void LoginByWechat(object sender, MouseEventArgs mouseEventArgs)
-        {
-#if Android
-            //var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP),
-            //    Language.StringByID(R.MyInternationalizationString.LoginByWechat),
-            //    Language.StringByID(R.MyInternationalizationString.Cancel),
-            //    Language.StringByID(R.MyInternationalizationString.Confrim));
-            //alert.Show();
-            //alert.ResultEventHandler += (send, e) =>
-            //{
-                //if (e)
-                //{
-                    com.hdl.home.Application.WXLogin();
-                    com.hdl.home.WXEntryActivity.RespAction = (authStr) =>
-                    {
-                        if (authStr == null)
-                        {
-
-                        }
-                        else
-                        {
-                            new System.Threading.Thread(async () =>
-                            {
-                                var re = await isBindAuthAsync(authStr);
-                                if (re)
-                                {
-                                    Application.RunOnMainThread(() =>
-                                    {
-                                        //鐩存帴鐧诲綍
-                                        HomePage.Instance.ShowLoginLoadView();
-                                    });
-                                    var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
-                                    var homes = await House.GetHomeLists();
-                                    //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
-                                    await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
-                                    //鍚姩ZigBee
-                                    ZigBee.Common.Application.Init();
-                                    UserCenter.HdlRoomLogic.Current.InitAllRoom();
-                                    Application.RunOnMainThread(() =>
-                                    {
-                                        this.RemoveFromParent();
-                                        CommonPage.Instance.RemoveViewByTag("Login");
-                                        UserPage.Instance.Fresh();
-                                    });
-                                }
-                                else
-                                {
-                                    var authRes = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.AuthUserRes>(authStr);
-                                    Application.RunOnMainThread(() =>
-                                    {
-                                        var registerPage = new AccountRegister();
-                                        Shared.Common.CommonPage.Instance.AddChidren(registerPage);
-                                        registerPage.OpenID = authRes.openid;
-                                        registerPage.Show();
-                                    });
-                                }
-                            })
-                            { IsBackground = true }.Start();
-                        }
-                    };
-                //}
-            //};
-#endif
+        }
 
+        #endregion
+
+        #region 鈻� 寰俊鐧婚檰___________________________
+
+        /// <summary>
+        /// 寰俊鐧诲綍
+        /// </summary>
+        private void LoginByWechat()
+        {
+#if Android
+            com.hdl.home.Application.WXLogin();
+            com.hdl.home.WXEntryActivity.RespAction = (authStr) =>
+            {
+#endif
 #if iOS
             Home.IOS.AppDelegate.WXLogin();
             Home.IOS.AppDelegate.RespAction = (authStr) =>
-            {
-                if (authStr == null)
-                {
-
-                }
-                else
-                {
-                    new System.Threading.Thread(async () =>
-                    {
-
-                        var re = await isBindAuthAsync(authStr);
-                        if (re)
-                        {
-                            //鐩存帴鐧诲綍
-                            //this.RemoveFromParent();
-
-                            //UserPage.Instance.Fresh();
-                            var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
-                            var homes = await House.GetHomeLists();
-                            //鍚姩ZigBee
-                            ZigBee.Common.Application.Init();
-                            //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
-                            await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
-                            UserCenter.HdlRoomLogic.Current.InitAllRoom();
-                            Application.RunOnMainThread(() =>
-                            {
-                                this.RemoveFromParent();
-                                UserPage.Instance.Fresh();
-                            });
-                        }
-                        else
-                        {
-                            var authRes = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.AuthUserRes>(authStr);
-                            Application.RunOnMainThread(() =>
-                            {
-                                var registerPage = new AccountRegister();
-                                Shared.Common.CommonPage.Instance.AddChidren(registerPage);
-                                registerPage.OpenID = authRes.openid;
-                                registerPage.Show();
-                            });
-                        }
-                    })
-                    { IsBackground = true }.Start();
-                }
-            };
-#endif
+            {
+#endif
+                if (authStr == null)
+                {
+                    return;
+                }
+                HdlThreadLogic.Current.RunThread(async () =>
+                {
+                    //鏄惁宸茬粡缁戝畾
+                    var re = await isBindAuthAsync(authStr);
+                    if (re)
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            //鐩存帴鐧诲綍
+                            HomePage.Instance.ShowLoginLoadView();
+                        });
+                        var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
+                        var homes = await House.GetHomeLists();
+                        //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
+                        await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
+                        //鍚姩ZigBee
+                        ZigBee.Common.Application.Init();
 
+                        Application.RunOnMainThread(() =>
+                        {
+                            this.RemoveFromParent();
+                            CommonPage.Instance.RemoveViewByTag("Login");
+                            UserPage.Instance.Fresh();
+                        });
+                    }
+                    else
+                    {
+                        var authRes = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.ResponseEntity.AuthUserRes>(authStr);
+                        Application.RunOnMainThread(() =>
+                        {
+                            var registerPage = new AccountRegister();
+                            CommonPage.Instance.AddChidren(registerPage);
+                            registerPage.OpenID = authRes.openid;
+                            registerPage.Show();
+                        });
+                    }
+                });
+            };
+        }
 
-
-        }
-
-        /// <summary>
-        /// qq鐧诲綍
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="mouseEventArgs"></param>
-        private void LoginByQQ(object sender, MouseEventArgs mouseEventArgs)
-        {
-
-        }
-
         /// <summary>
         /// 鏄惁宸茬粦瀹�
         /// </summary>
@@ -686,15 +909,13 @@
             if (stateCodeStr == "SUCCESS")
             {
                 var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
-                var revertData = responseDataObj;
+                var revertData = responseDataObj;
+                //鏍囪涓婁竴娆℃槸涓嶆槸鍚屼竴涓处鍙风櫥闄�
+                UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
                 Config.Instance.Account = revertData.Account;
                 Config.Instance.MD5PWD = revertData.MD5PWD;
                 Config.Instance.Guid = revertData.Guid;
                 Config.Instance.LoginDateTime = DateTime.Now;
-                if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
-                {
-                    Config.Instance.AccountList.Add(revertData.Account);
-                }
                 Config.Instance.Save();
                 return true;
             }
@@ -702,158 +923,293 @@
             {
                 return false;
             }
+        }
+
+        #endregion
+
+        #region 鈻� 楠岃瘉鐮佺櫥闄哶________________________
+
+        /// <summary>
+        /// 楠岃瘉鐮佺櫥闄�
+        /// </summary>
+        /// <param name="i_account">璐﹀彿</param>
+        /// <param name="i_verCode">楠岃瘉鐮�</param>
+        /// <param name="i_div">1:鎵嬫満鍙� 2:閭</param>
+        private async void LoginByVerCode(string i_account, string i_verCode, int i_div)
+        {
+            var pra = new SendDataToServer.LoginValidCodeOBJ()
+            {
+                Account = i_account,
+                Code = i_verCode,
+                Language = CommonPage.ZigBeeLanguage,
+                AreaCode = int.Parse(CommonPage.PhoneZoneStr)
+            };
+            var result = await CommonFormResouce.LoginByCode(pra);
+            //澶勭悊鐧婚檰鎴愬姛鐨勬暟鎹�
+            this.AdjustLoginSuccessData(result, pra, i_account, string.Empty, i_div);
         }
 
-        /// <summary>
-        /// phone/email 閫夋嫨
-        /// </summary>
-        /// <param name="sender"></param>
-        /// <param name="mouseEventArgs"></param>
-        private void SelectPhoneOrEmail_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
-        {
-            phoneEmailForm.SelectedPhone.IsSelected = phoneEmailForm.SelectedEmail.IsSelected = false;
-            phoneEmailForm.SelectedPhone.IsBold = phoneEmailForm.SelectedEmail.IsBold = false;
-            loginBtn.Enable = loginBtn.IsSelected = false;
-            loginErrorBtn.Text = string.Empty;
-            (sender as Button).IsSelected = (sender as Button).IsBold = true;
-            if((sender as Button).Tag.ToString()=="Phone")
-            {
-                AddPhoneOrEmailFL(accountPwdFL, "Phone");
-            }
-            else
-            {
-                AddPhoneOrEmailFL(accountPwdFL, "Email");
-            }
+        /// <summary>
+        /// 鍙戦�侀獙璇佺爜
+        /// </summary>
+        /// <param name="btnSendCode">鍙戦�佹寜閽�</param>
+        /// <param name="account">璐﹀彿</param>
+        /// <param name="i_div">1:鎵嬫満鍙� 2:閭</param>
+        /// <returns></returns>
+        private async System.Threading.Tasks.Task<bool> SendVerCode(NormalViewControl btnSendCode, string account, int i_div)
+        {
+            //涓嶈兘鍐嶇偣鍑�
+            btnSendCode.CanClick = false;
+
+            int companyInt = 0;
+            if (CommonPage.PhoneZoneStr == "86" || i_div == 2)
+            {
+                companyInt = CommonPage.Company;
+            }
+            else
+            {
+                companyInt = CommonPage.CompanyForINTERNETION;
+            }
+            var reqDtoSignPhone = new SendDataToServer.LoginSendVerCodeObj()
+            {
+                Account = account,
+                Company = companyInt,
+                AreaCode = int.Parse(CommonPage.PhoneZoneStr),
+                Language = CommonPage.ZigBeeLanguage
+            };
+            var requestRevertObj = await CommonFormResouce.LoginSendVerCode(reqDtoSignPhone);
+            if (requestRevertObj == null)
+            {
+                //璇锋眰鏈嶅姟鍣ㄥけ璐�
+                CommonPage.Instance.FailureToServer();
+                return false;
+            }
+            var stateCodeStr = requestRevertObj.StateCode.ToUpper();
+            if (stateCodeStr == "SUCCESS")
+            {
+                //寮�鍚彂閫侀獙璇佺爜鐨勫�掕鏃�
+                this.StartSendVerCodeTimeOutThread(btnSendCode);
+                return true;
+            }
+            if (stateCodeStr == "PARAMETEROREMPTY")
+            {
+                //鎻愪緵鐨勫弬鏁伴敊璇�
+                btnErrorMsg.TextID = R.MyInternationalizationString.PARAMETEROREMPTY;
+            }
+            else if (stateCodeStr == "ACCOUNTNOEXISTS")
+            {
+                //璐﹀彿涓嶅瓨鍦�
+                btnErrorMsg.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
+            }
+            else if (stateCodeStr == "SENDFAIL")
+            {
+                //楠岃瘉鐮佸彂閫佸け璐�
+                btnErrorMsg.TextID = R.MyInternationalizationString.SENDFAIL;
+            }
+            else
+            {
+                //璇锋眰鏈嶅姟鍣ㄥけ璐�
+                btnErrorMsg.TextID = R.MyInternationalizationString.RequestServerFailed;
+                //鍐橪og
+                IMessageCommon.Current.GetMsgByRequestName("ZigbeeUsers/LoginSendVerCode", requestRevertObj, reqDtoSignPhone);
+            }
+
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //鍙戦�佸け璐ュ悗,5绉掍箣鍚庢墠鑳藉啀娆″彂閫�
+                int i = 0;
+                while (i <= 5)
+                {
+                    i++;
+                    System.Threading.Thread.Sleep(1000);
+                }
+                btnSendCode.CanClick = true;
+            });
+
+            return false;
         }
-        /// <summary>
-        /// AddPhoneOrEmailFL
-        /// </summary>
-        /// <param name="accountPwdFrameLayout"></param>
-        /// <param name="phoneOrEmail"></param>
-        private void AddPhoneOrEmailFL(FrameLayout accountPwdFrameLayout,string phoneOrEmail)
-        {
-            if (phoneOrEmail == "Phone")
-            {
-                if (phoneRow != null) 
+
+        /// <summary>
+        /// 寮�鍚彂閫侀獙璇佺爜鐨勫�掕鏃�
+        /// </summary>
+        /// <param name="btnSendCode"></param>
+        private void StartSendVerCodeTimeOutThread(NormalViewControl btnSendCode)
+        {
+            HdlThreadLogic.Current.RunThread(() =>
+            {
+                //鍚庨噸鍙�
+                string strText = Language.StringByID(R.MyInternationalizationString.SendVerificationCodeAgain);
+                int time = 60;
+                while (time > 0 && btnSendCode.Parent != null)
+                {
+                    HdlThreadLogic.Current.RunMain(() =>
+                    {
+                        btnSendCode.Text = time + "s" + strText;
+                    });
+                    time--;
+                    System.Threading.Thread.Sleep(1000);
+                }
+                //鍊掕鏃跺畬鎴愪箣鍚�,鍙互鍐嶆鐐瑰嚮
+                btnSendCode.CanClick = true;
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鑾峰彇楠岃瘉鐮�
+                    btnSendCode.Text = Language.StringByID(R.MyInternationalizationString.SendVerificationCode);
+                });
+            });
+        }
+
+        #endregion
+
+        #region 鈻� 澶勭悊鐧婚檰鎴愬姛鐨勬暟鎹甠________________
+
+        /// <summary>
+        /// 澶勭悊鐧婚檰鎴愬姛鐨勬暟鎹�
+        /// </summary>
+        /// <param name="revertObj">浜戠杩斿洖鐨勬暟鎹�</param>
+        /// <param name="pra">鎺ュ彛璇锋眰鍙傛暟</param>
+        /// <param name="i_account">璐﹀彿</param>
+        /// <param name="i_psw">瀵嗙爜锛岄獙璇佺爜鐧婚檰鏃�,璁剧疆涓� string.Empty</param>
+        /// <param name="i_div">1:鎵嬫満鍙� 2:閭</param>
+        private async void AdjustLoginSuccessData(Common.ResponseEntity.ResponsePack revertObj, object pra,
+            string i_account, string i_psw, int i_div)
+        {
+            if (revertObj == null)
+            {
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //璇锋眰鏈嶅姟鍣ㄥけ璐�
+                    CommonPage.Instance.FailureToServer();
+                    CommonPage.Loading.Hide();
+                });
+                return;
+            }
+            var stateCodeStr = revertObj.StateCode.ToUpper();
+            //Error 涓嶈兘鐩存帴浠庢湇鍔″櫒鍙栵紝鍙兘鏍规嵁鐘舵�佺爜閫愪竴鍒ゆ柇
+            if (stateCodeStr == "SUCCESS")
+            {
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    //鏄剧ず鍚姩椤�
+                    HomePage.Instance.ShowLoginLoadView();
+                });
+                //瀛樺偍鏁版嵁
+                var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
+                var revertData = responseDataObj;
+                Config.ReFresh();
+                //鏍囪涓婁竴娆℃槸涓嶆槸鍚屼竴涓处鍙风櫥闄�
+                UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
+                Config.Instance.Account = revertData.Account;
+                Config.Instance.Password = i_psw;
+                Config.Instance.MD5PWD = revertData.MD5PWD;
+                Config.Instance.Guid = revertData.Guid;
+                Config.Instance.LoginDateTime = DateTime.Now;
+                Config.Instance.LoginToken = revertData.Token;
+                Config.Instance.Save();
+
+                var resultRegID = await CommonPage.Instance.PushRegID();
+                var homes = await House.GetHomeLists();
+                //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
+                await UserCenterLogic.InitUserCenterMenmoryAndThread();
+                //鍚姩ZigBee
+                ZigBee.Common.Application.Init();
+
+                HdlThreadLogic.Current.RunMain(() =>
+                {
+                    CommonPage.Loading.Hide();
+                    this.RemoveFromParent();
+                    CommonPage.Instance.RemoveViewByTag("Login");
+                    UserPage.Instance.Fresh();
+                });
+                return;
+            }
+            //鍏抽棴杞湀鐨�
+            HdlThreadLogic.Current.RunMain(() =>
+            {
+                CommonPage.Loading.Hide();
+                if (stateCodeStr == "NOTVERIFY")
+                {
+                    //鏈縺娲�
+                    btnErrorMsg.TextID = R.MyInternationalizationString.NOTVERIFY;
+                }
+                else if (stateCodeStr == "NOTENABLE")
+                {
+                    //璇ョ敤鎴峰睘浜庤皟璇曡处鍙凤紝骞舵湭鍚敤
+                    btnErrorMsg.TextID = R.MyInternationalizationString.NOTENABLE;
+                }
+                else if (stateCodeStr == "PARAMETEROREMPTY")
                 {
-                    phoneRow.Visible = true;
-                    phonePwdRow.Visible = true;
-                    if (emailRow != null)
-                    { 
-                        emailRow.Visible = false;
-                        emailPwdRow.Visible = false;
+                    //鎻愪緵鐨勫弬鏁伴敊璇�
+                    btnErrorMsg.TextID = R.MyInternationalizationString.PARAMETEROREMPTY;
+                }
+                else if (stateCodeStr == "VALIDCODEANDPHONENOEQUAL")
+                {
+                    //楠岃瘉鐮侀敊璇紝璇烽噸鏂拌緭鍏�
+                    btnErrorMsg.TextID = R.MyInternationalizationString.VALIDCODEANDPHONENOEQUAL;
+                }
+                else if (stateCodeStr == "USERNAMEORPWDERROR")
+                {
+                    //璐﹀彿鎴栧瘑鐮侀敊璇�
+                    btnErrorMsg.TextID = R.MyInternationalizationString.USERNAMEORPWDERROR;
+                }
+                else if (stateCodeStr == "ACCOUNTNOEXISTS")
+                {
+                    //璐﹀彿涓嶅瓨鍦�
+                    btnErrorMsg.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
+                }
+                else if (stateCodeStr == "NORECORD" && i_psw == string.Empty)
+                {
+                    //璇峰厛鑾峰彇楠岃瘉鐮�
+                    btnErrorMsg.TextID = R.MyInternationalizationString.NORECORD;
+                }
+                else if (stateCodeStr == "YOUDATANOISLOCALREGION")
+                {
+                    //涓嶅湪鏈尯鍩燂紝闇�瑕侀噸瀹氬悜鍖哄煙鍚庡啀娆¤姹傜櫥褰�
+                    var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginLocalRegionRes>(revertObj.ResponseData.ToString());
+                    CommonPage.RequestHttpsHost = responseDataObj.RegionServer;
+                    if (i_psw != string.Empty)
+                    {
+                        //鍐嶆鐧诲綍
+                        this.LoginByAccountAndPsw(i_account, i_psw, i_div);
                     }
-                    this.Pwd_TextChange(phonePwdRow);
-                    return;
-                }
-                phoneRow = new PhoneLoginRowForm();
-                phoneRow.Init(accountPwdFrameLayout, this, this.oldInputAccount, 29, 29);
-                phoneRow.AccountET.TextChangeEventHandler += Account_TextChange;
-
-                phonePwdRow = new PwdLoginRowForm();
-                phonePwdRow.Init(accountPwdFrameLayout, 29, 225);
-                phonePwdRow.PasswrodET.TextChangeEventHandler += (sender, e) =>
+                }
+                else
                 {
-                    this.Pwd_TextChange(phonePwdRow);
-                };
-            }
-            else
-            {
-                if (emailRow != null)
-                {
-                    emailRow.Visible = true;
-                    emailPwdRow.Visible = true;
-                    if (phoneRow != null) 
-                    { 
-                        phoneRow.Visible = false;
-                        phonePwdRow.Visible = false;
+                    btnErrorMsg.TextID = R.MyInternationalizationString.RequestServerFailed;
+                    //鍐橪og
+                    if (pra is SendDataToServer.LoginObj)
+                    {
+                        ((SendDataToServer.LoginObj)pra).Password = "*********";
+                        IMessageCommon.Current.GetMsgByRequestName("ZigbeeUsers/Login", revertObj, pra);
                     }
-                    this.Pwd_TextChange(emailPwdRow);
-                    return;
-                }
-                emailRow = new EmailLoginRowForm();
-                emailRow.Init(accountPwdFrameLayout, this.oldInputAccount, 29, 29);
-                emailRow.AccountET.TextChangeEventHandler += Account_TextChange;
+                    else
+                    {
+                        IMessageCommon.Current.GetMsgByRequestName("ZigbeeUsers/LoginValidCode", revertObj, pra);
+                    }
+                }
+            });
+        }
 
-                emailPwdRow = new PwdLoginRowForm();
-                emailPwdRow.Init(accountPwdFrameLayout, 29, 225);
-                emailPwdRow.PasswrodET.TextChangeEventHandler += (sender, e) =>
-                {
-                    this.Pwd_TextChange(emailPwdRow);
-                };
-            }
-        }
         #endregion
+
+        #region 鈻� 涓�鑸柟娉昣__________________________
 
-
-        #region 鈼� 蹇樿瀵嗙爜________________________
-        /// <summary>
-        /// 蹇樿瀵嗙爜
-        /// </summary>
-        private void ForgetPWD_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
-        {
-            var forgot = new AccountForgetPWD();
-            CommonPage.Instance.AddChidren(forgot);
-            forgot.Show();
+        /// <summary>
+        /// 妫�娴嬮殣绉佸崗璁�
+        /// </summary>
+        /// <returns></returns>
+        private bool CheckPrivacyPolicy()
+        {
+            if (isAgreePrivacyPolicy == false)
+            {
+                //璇峰厛闃呰骞跺悓鎰忋�婇殣绉佹潈鏀跨瓥銆嬪拰銆婃湇鍔℃潯娆俱��
+                var btnMsg = new ShowMsgControl(ShowMsgType.Remind, Language.StringByID(R.MyInternationalizationString.uPleaseReadAndAgreePrivacyPolicyMsg));
+                btnMsg.Show();
+                return false;
+            }
+            return true;
         }
 
         #endregion
-
-        #region 鈼� 娉ㄥ唽_____________________________
-
-        /// <summary>
-        /// 娉ㄥ唽
-        /// </summary>
-        /// <param name="sender">Sender.</param>
-        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
-        private void Register(object sender,MouseEventArgs mouseEventArgs)
-        {
-            var registerPage = new AccountRegister();
-            CommonPage.Instance.AddChidren(registerPage);
-            registerPage.Show();
-        }
-
-        #endregion
-
-        #region 鈼� 璐﹀彿瀵嗙爜鐩戝惉______________________
-        /// <summary>
-        /// 璐﹀彿鐩戝惉
-        /// </summary>
-        /// <param name="sender">Sender.</param>
-        /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
-        private void Account_TextChange(object sender,string mouseEventArgs)
-        {
-            loginErrorBtn.Text = string.Empty;
-        }
-
-        /// <summary>
-        /// 瀵嗙爜鐩戝惉浜嬩欢
-        /// </summary>
-        /// <param name="pwdRow">Sender.</param>
-        private void Pwd_TextChange(PwdLoginRowForm pwdRow)
-        {
-            loginErrorBtn.Text = string.Empty;
-            string pswText = pwdRow.PasswrodET.Text.Trim();
-            if (1 <= pswText.Length && pswText.Length <= 16 && (phoneRow.AccountET.Text.Trim().Length > 0 || emailRow?.AccountET.Text.Trim().Length>0))
-            {
-                loginBtn.Enable = loginBtn.IsSelected = true;
-            }
-            else if (pswText.Length > 16)
-            {
-                pwdRow.PasswrodET.Text = pswText.Substring(0, 16);
-                if (phoneRow.AccountET.Text.Trim().Length > 0 || emailRow?.AccountET.Text.Trim().Length > 0)
-                {
-                    loginBtn.Enable = loginBtn.IsSelected = true;
-                }
-            }
-            else
-            {
-                loginBtn.Enable = loginBtn.IsSelected = false;
-            }
-        }
-
-
-        #endregion
-
     }
 }

--
Gitblit v1.8.0