From bdb67e76871e6ad47c353cd0350a1ac04d913823 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 十二月 2020 13:32:25 +0800
Subject: [PATCH] 20201223-5

---
 HDL_ON/Common/ApiUtlis.cs |   59 ++++++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index d1aace8..24eac42 100644
--- a/HDL_ON/Common/ApiUtlis.cs
+++ b/HDL_ON/Common/ApiUtlis.cs
@@ -64,18 +64,21 @@
             if (MainPage.InternetStatus == 0)
                 return;
             //绾跨▼寮�濮嬫椂闂�
-            var beginTime = DateTime.Now.AddSeconds(6);
+            var endTime = DateTime.Now.AddSeconds(6);
+
+            MainPage.Log($"寮�濮嬪悓姝ヤ簯绔暟鎹�");
 
             DownloadDataComplete = false;
 
             var waitPage = new Loading();
             MainPage.BaseView.AddChidren(waitPage);
-            waitPage.Start();
+            waitPage.Start(Language.StringByID(StringId.PleaseWait));
 
             string code = StateCode.SUCCESS;
 
             var downloadDataThread = new System.Threading.Thread(() =>
             {
+                MainPage.Log($"杩涘叆璇诲彇浜戠鏁版嵁绾跨▼");
                 //===================鍒锋柊Token=======================
                 code = Ins.HttpRequest.RefreshToken();
                 if (code != StateCode.SUCCESS)
@@ -249,7 +252,8 @@
                 {
                     Application.RunOnMainThread(() =>
                     {
-                        beginTime = DateTime.MinValue;
+                        MainPage.Log($"缁撴潫璇诲彇浜戠鏁版嵁绾跨▼");
+                        endTime = DateTime.MinValue;
                         DownloadDataComplete = true;
                         waitPage.Hide();
                         waitPage.RemoveFromParent();
@@ -257,33 +261,46 @@
                 }
             });
             downloadDataThread.IsBackground = true;
+            downloadDataThread.Priority = System.Threading.ThreadPriority.Highest;
             downloadDataThread.Start();
 
             //缃戠粶鍗¢】锛岀粓姝笅杞界嚎绋�
             new System.Threading.Thread(() =>
             {
-                while (beginTime < DateTime.Now)
+                try
                 {
-                    if (DownloadDataComplete)
+                    while (endTime > DateTime.Now)
                     {
-                        break;
+                        if (DownloadDataComplete)
+                        {
+                            break;
+                        }
+                        System.Threading.Thread.Sleep(100);
                     }
-                    System.Threading.Thread.Sleep(100);
-                }
-                if (!DownloadDataComplete)
-                {
-                    downloadDataThread.Abort();
-                }
-                DownloadDataComplete = true;
-                Application.RunOnMainThread(() =>
-                {
-                    waitPage.Hide();
-                    waitPage.RemoveFromParent();
-                });
-                //鍒濆鍖栨暟鎹�
-                //SpatialInfo.CurrentSpatial.Clear();
+                    if (!DownloadDataComplete)
+                    {
+                        //downloadDataThread.Abort();
+                    }
+                    DownloadDataComplete = true;
+                    Application.RunOnMainThread(() =>
+                    {
+                        waitPage.Hide();
+                        waitPage.RemoveFromParent();
+                    });
+                    //鍒濆鍖栨暟鎹�
+                    //SpatialInfo.CurrentSpatial.Clear();
 
-
+                }
+                catch { }
+                finally
+                {
+                    #region 璇诲彇鏈湴鏁版嵁
+                    //璇诲彇闊充箰淇℃伅
+                    UI.Music.A31MusicModel.ReadMusicStates();
+                    //鎼滅储缃戝叧
+                    DriverLayer.Control.Ins.SearchLoaclGateway();
+                    #endregion
+                }
             })
             { IsBackground = true }.Start();
         }

--
Gitblit v1.8.0