From b9c9c77fe50a9098f62a338c44c8598690177b90 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 23 十二月 2020 10:58:23 +0800
Subject: [PATCH] Merge branch 'NewFilePath' into CJL

---
 HDL_ON/UI/MainPage.cs |   86 ++++++++++++++++++++++++-------------------
 1 files changed, 48 insertions(+), 38 deletions(-)

diff --git a/HDL_ON/UI/MainPage.cs b/HDL_ON/UI/MainPage.cs
index b834063..14fe9bd 100644
--- a/HDL_ON/UI/MainPage.cs
+++ b/HDL_ON/UI/MainPage.cs
@@ -26,7 +26,7 @@
         /// <summary>
         /// 鐗堟湰鍙�
         /// </summary>
-        public static string VersionString = "1.0.1220";
+        public static string VersionString = "1.0.1222";
         ///// <summary>
         ///// 瀹㈡埛绔被鍨�
         ///// </summary>
@@ -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