From e0b8a7e79691d6187e4ea01a5cdd1f8802f8b00c Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 十二月 2020 09:34:43 +0800
Subject: [PATCH] 20201223-1

---
 HDL_ON/UI/MainPage.cs |   84 +++++++++++++++++++++++------------------
 1 files changed, 47 insertions(+), 37 deletions(-)

diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index d4fd18f..14fe9bd 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -109,14 +109,15 @@
                     }
                     else
                     {
-                        new System.Threading.Thread(() =>
-                        {
-                            var pm = new DAL.Server.HttpServerRequest();
-                            pm.RefreshToken();//鍒锋柊Token
-                            pm.GetHomePager();//鍒锋柊浣忓畢淇℃伅
-                            pm.GetUserInfo();//鍒锋柊涓汉淇℃伅
-                        })
-                        { IsBackground = true }.Start();
+                        //new System.Threading.Thread(() =>
+                        //{
+                        //    var pm = new DAL.Server.HttpServerRequest();
+                        //    pm.RefreshToken();//鍒锋柊Token
+                        //    pm.GetHomePager();//鍒锋柊浣忓畢淇℃伅
+                        //    pm.GetUserInfo();//鍒锋柊涓汉淇℃伅
+                        //})
+                        //{ IsBackground = true }.Start();
+                        Common.ApiUtlis.Ins.DownloadData();
 
                         GoUserPage(true);
                     }
@@ -226,8 +227,11 @@
                     MainPage.Log($"GoUserPage : {ex.Message}");
                 }finally
                 {
-                    ///鍒濆鍖朼pp鏁版嵁
-                    InitializationData();
+                    Application.RunOnMainThread(() =>
+                    {
+                        ///鍒濆鍖朼pp鏁版嵁
+                        InitializationData();
+                    });
                 }
             }).Start();
         }
@@ -237,34 +241,40 @@
         /// </summary>
         public static void InitializationData()
         {
-            new System.Threading.Thread(() =>
-            {
-                while (true)
-                {
-                    if (Entity.DB_ResidenceData.Instance == null )//|| Entity.DB_ResidenceData.residenceData.HomeGateway == null)
-                    {
-                        System.Threading.Thread.Sleep(100);
-                    }
-                    else
-                    {
-                        break;
-                    }
-                }
-                //System.Threading.Thread.Sleep(2000);
-                #region 璇诲彇浜戠鏁版嵁--
-                //todo鏁版嵁瑕嗙洊澶勭悊
-                //璇诲彇浜戠鎴块棿銆佹ゼ灞傛暟鎹�
-                Entity.SpatialInfo.CurrentSpatial.DownloadRoomList();
-                //璇诲彇浜戠璁惧鏁版嵁
-                Entity.FunctionList.List.DownloadFunctionList();
-                //璇诲彇浜戠鍦烘櫙鏁版嵁
-                Entity.FunctionList.List.DownloadSceneList();
-                //璇诲彇閫昏緫鍒楄〃
-                UI.UI2.Intelligence.Automation.MainView.GetLogicList();
-                #endregion
+            //new System.Threading.Thread(() =>
+            //{
+            //    int count = 0;
+            //    while (count< 10)
+            //    {
+            //        if (Entity.DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull() )//|| Entity.DB_ResidenceData.residenceData.HomeGateway == null)
+            //        {
+            //            System.Threading.Thread.Sleep(200);
+            //        }
+            //        else
+            //        {
+            //            break;
+            //        }
+            //        count++;
+            //    }
+            //    if(Entity.DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
+            //    {
+            //        return;
+            //    }
+            //    //System.Threading.Thread.Sleep(2000);
+            //    #region 璇诲彇浜戠鏁版嵁--
+            //    //todo鏁版嵁瑕嗙洊澶勭悊
+            //    //璇诲彇浜戠鎴块棿銆佹ゼ灞傛暟鎹�
+            //    Entity.SpatialInfo.CurrentSpatial.DownloadRoomList();
+            //    //璇诲彇浜戠璁惧鏁版嵁
+            //    Entity.FunctionList.List.DownloadFunctionList();
+            //    //璇诲彇浜戠鍦烘櫙鏁版嵁
+            //    Entity.FunctionList.List.DownloadSceneList();
+            //    //璇诲彇閫昏緫鍒楄〃
+            //    UI.UI2.Intelligence.Automation.MainView.GetLogicList();
+            //    #endregion
 
-            })
-            { IsBackground = true }.Start();
+            //})
+            //{ IsBackground = true }.Start();
 
             #region 璇诲彇鏈湴鏁版嵁
             //璇诲彇闊充箰淇℃伅

--
Gitblit v1.8.0