From d0396d3f30d46810f8453bf21f86bd93fe5dbdec Mon Sep 17 00:00:00 2001
From: lss <316519258@qq.com>
Date: 星期三, 10 六月 2020 15:54:37 +0800
Subject: [PATCH] test

---
 ZigbeeApp/Shared/Phone/UserView/HomePage.cs |   61 +++++++++++++-----------------
 1 files changed, 27 insertions(+), 34 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs
index 835452c..bbb9565 100755
--- a/ZigbeeApp/Shared/Phone/UserView/HomePage.cs
+++ b/ZigbeeApp/Shared/Phone/UserView/HomePage.cs
@@ -4,7 +4,7 @@
 namespace Shared.Phone.UserView
 {
     /// <summary>
-    /// Home page.
+    /// Home page.绗簩鐗堝憖
     /// </summary>
     public class HomePage : PageLayout
     {
@@ -49,10 +49,9 @@
                 }
             };
 
-            //*******寰呮敼*****
-            UserPage.Instance.Fresh();
             if (Config.Instance.IsLogin)
             {
+                ShowLoginLoadView();
                 CommonPage.Loading.Start();
                 Action action = async () =>
                 {
@@ -62,19 +61,18 @@
                     {
                         new System.Threading.Thread(async () =>
                         {
-                            ZigBee.Common.Application.Init();
-                           
                             //鐧诲綍鎴愬姛
                             var homes = await House.GetHomeLists();
-
                             //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
-                            await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
+                            await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
+                            //鍚姩ZigBee
+                            ZigBee.Common.Application.Init();
 
-                            Room.canInitAllRoom = true;
-                            Room.InitAllRoom();
+                            UserCenter.HdlRoomLogic.Current.InitAllRoom();
 
                             Application.RunOnMainThread(() =>
                             {
+                                CommonPage.Instance.RemoveViewByTag("Login");
                                 UserPage.Instance.Fresh(); 
                                 CommonPage.Loading.Hide();
                             });
@@ -94,19 +92,18 @@
                         //鐧诲綍澶辫触锛屼篃鐩存帴杩涘叆涓婚〉
                         new System.Threading.Thread(async () =>
                         {
-                            ZigBee.Common.Application.Init();
-
                             //鐧诲綍鎴愬姛
                             var homes = await House.GetHomeLists();
-
                             //鍒锋柊涓汉涓績鐨勫唴瀛樺強绾跨▼
-                            await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
+                            await UserCenter.UserCenterLogic.InitUserCenterMenmoryAndThread();
+                            //鍚姩ZigBee
+                            ZigBee.Common.Application.Init();
 
-                            Room.canInitAllRoom = true;
-                            Room.InitAllRoom();
+                            UserCenter.HdlRoomLogic.Current.InitAllRoom();
 
                             Application.RunOnMainThread(() =>
                             {
+                                CommonPage.Instance.RemoveViewByTag("Login");
                                 UserPage.Instance.Fresh();
                                 CommonPage.Loading.Hide();
                             });
@@ -120,10 +117,18 @@
             else
             {
                 //鏈櫥褰曞脊鍑虹櫥褰曠晫闈�
-                var accountLogin = new Device.Account.AccountLogin { };
+                var accountLogin = new Login.AccountLogin { };
                 Shared.Common.CommonPage.Instance.AddChidren(accountLogin);
-                accountLogin.Show();
+                accountLogin.ShowForm();
             }
+        }
+
+
+        public void ShowLoginLoadView()
+        {
+            var loginLoad = new LoginLoading { };
+            CommonPage.Instance.AddChidren(loginLoad);
+            loginLoad.Show();
         }
 
         /// <summary>
@@ -146,9 +151,6 @@
                     Source = source,
                     Company = company
                 };
-                //灏嗙鐞嗗憳鏍囪瘑澶嶅師
-                Config.Instance.isAdministrator = false;
-
                 var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
                 var revertObj = await CommonPage.Instance.RequestHttpsZigbeeAsync("ZigbeeUsers/Login", System.Text.Encoding.UTF8.GetBytes(requestJson));
                 if (revertObj == null)
@@ -164,26 +166,17 @@
                     {
                         return -1;
                     }
-                    //鍒濆鍖栫鐞嗗憳鏉冮檺淇℃伅(閲岄潰鏈夌壒娈婂垽鏂簡,鍙互鐩存帴璋冪敤)
-                    await UserCenter.UserCenterLogic.InitAdministratorInfo();
 
                     var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(revertObj.ResponseData.ToString());
-                    var revertData = responseDataObj;
-                    Config.Instance.UserID = revertData.UserID;
-                    Config.Instance.MasterID = revertData.MainUserID;
-                    Config.Instance.AccountType = revertData.UserType;
+                    var revertData = responseDataObj;
+                    //鏍囪涓婁竴娆℃槸涓嶆槸鍚屼竴涓处鍙风櫥闄�
+                    UserCenter.UserCenterResourse.ResidenceOption.TheSameLoginAccount = Config.Instance.Guid == revertData.Guid;
                     Config.Instance.Account = revertData.Account;
                     Config.Instance.Password = password;
+                    Config.Instance.MD5PWD = revertData.MD5PWD;
                     Config.Instance.Guid = revertData.Guid;
-                    Config.Instance.MqttKey = revertData.MqttKey;
                     Config.Instance.LoginDateTime = DateTime.Now;
-                    Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd;
-                    Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId;
-                    Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain;
-                    if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
-                    {
-                        Config.Instance.AccountList.Add(revertData.Account);
-                    }
+                    Config.Instance.LoginToken = revertData.Token;
                     isLoginSuccess = 1;
                     var resultRegID = await Shared.Common.CommonPage.Instance.PushRegID();
                     System.Console.WriteLine($"鍚庡彴鐧诲綍鎴愬姛--{Config.Instance.LoginDateTime}");

--
Gitblit v1.8.0