From ff3cfcf62632bf43e51a6b6098c203bf0f5cddbc Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期二, 24 十二月 2019 19:53:29 +0800
Subject: [PATCH] 2019.12.24

---
 ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs |   55 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs
index 6f5a457..fd7b59a 100644
--- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs
@@ -303,19 +303,15 @@
                     HomePage.Instance.ShowLoginLoadView();
                     new System.Threading.Thread(async () =>
                     {
-                        //鍚姩ZigBee
-                        ZigBee.Common.Application.Init();
                         var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(requestRevetLoginCodeOBJ.ResponseData.ToString());
                         var revertData = responseDataObj;
                         Config.ReFresh();
+                        Config.Instance.Password = string.Empty;
                         Config.Instance.Account = revertData.Account;
-                        Config.Instance.MqttKey = revertData.MqttKey;
                         Config.Instance.Guid = revertData.Guid;
                         Config.Instance.MD5PWD = revertData.MD5PWD;
                         Config.Instance.LoginDateTime = DateTime.Now;
-                        Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd;
-                        Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId;
-                        Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain;
+                        Config.Instance.LoginToken = revertData.Token;
                         if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
                         {
                             Config.Instance.AccountList.Add(revertData.Account);
@@ -324,8 +320,9 @@
                         Config.Instance.MD5PWD = revertData.MD5PWD;
                         Config.Instance.Save();
                         var resultRegID = await CommonPage.Instance.PushRegID();
-                        var homes = await House.GetHomeLists();
-
+                        var homes = await House.GetHomeLists();
+                        //鍚姩ZigBee
+                        ZigBee.Common.Application.Init();
                         //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
                         await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
 
@@ -437,6 +434,7 @@
         {
             accountCodeFrameLayout.RemoveAll();
             account = string.Empty;
+            loginErrorBtn.Text = string.Empty;
             if (phoneOrEmail == "Phone")
             {
                 phoneRow = new PhoneRowForm();
@@ -465,7 +463,7 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void Account_TextChange(object sender, string mouseEventArgs)
         {
-            loginErrorBtn.Text = "";
+            loginErrorBtn.Text = string.Empty;
             if ((sender as EditText).Text.Trim().Length > 0)
             {
                 IsRightAccount = true;
@@ -545,9 +543,9 @@
         private void Register(object sender, MouseEventArgs mouseEventArgs)
         {
             this.RemoveFromParent();
-            var login = new AccountLogin();
-            CommonPage.Instance.AddChidren(login);
-            login.Show();
+            var registerPage = new AccountRegister();
+            CommonPage.Instance.AddChidren(registerPage);
+            registerPage.Show();
         }
 
         #endregion
@@ -574,6 +572,11 @@
         /// <param name="mouseEventArgs"></param>
         private async void SendCode_MouseUpEventAsync(object sender, MouseEventArgs mouseEventArgs)
         {
+            if (CheckAccount(account) == false)
+            {
+                return;
+            }
+
             (sender as Button).Enable = (sender as Button).IsSelected = false;
             CommonPage.Loading.Start();
             try
@@ -642,6 +645,34 @@
                 CommonPage.Loading.Hide();
             }
         }
+
+        /// <summary>
+        /// CheckAccount
+        /// </summary>
+        /// <param name="accountStr"></param>
+        /// <returns></returns>
+        private bool CheckAccount(string accountStr)
+        {
+            loginErrorBtn.Text = string.Empty;
+            if (phoneEmailForm.SelectedEmail.IsSelected)
+            {
+                if (AccountLogic.Instance.CheckEmail(accountStr) == false)
+                {
+                    loginErrorBtn.TextID = R.MyInternationalizationString.TheEmailError;
+                    return false;
+                }
+            }
+            else
+            {
+                if (AccountLogic.Instance.CheckPhoneWithZone(accountStr, CommonPage.PhoneZoneStr) == false)
+                {
+                    loginErrorBtn.TextID = R.MyInternationalizationString.ThePhoneError;
+                    return false;
+                }
+            }
+            return true;
+        }
+
         #endregion
 
         #region 鈼� 楠岃瘉楠岃瘉鐮乢_______________________

--
Gitblit v1.8.0