From f345087dbefecef9146fdb13481cb9ee3320d576 Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期三, 23 十二月 2020 11:46:28 +0800 Subject: [PATCH] 20201223-2 --- HDL_ON/Common/ApiUtlis.cs | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-) diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index c564f63..069acdc 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -63,6 +63,8 @@ { if (MainPage.InternetStatus == 0) return; + //绾跨▼寮�濮嬫椂闂� + var beginTime = DateTime.MinValue; DownloadDataComplete = false; @@ -72,10 +74,11 @@ string code = StateCode.SUCCESS; - new System.Threading.Thread(() => { + var downloadDataThread = new System.Threading.Thread(() => + { //===================鍒锋柊Token======================= code = Ins.HttpRequest.RefreshToken(); - if(code != StateCode.SUCCESS) + if (code != StateCode.SUCCESS) { MainPage.Log($"鍒锋柊token澶辫触"); return; @@ -237,20 +240,51 @@ //===================璇诲彇閫昏緫鍒楄〃========================== UI.UI2.Intelligence.Automation.MainView.GetLogicList(); - }catch(Exception ex) + } + catch (Exception ex) { MainPage.Log($"鏁版嵁鍒濆鍖栧け璐ワ細{ex.Message}"); } finally { - Application.RunOnMainThread(() => { + Application.RunOnMainThread(() => + { + beginTime = DateTime.Now; DownloadDataComplete = true; waitPage.Hide(); waitPage.RemoveFromParent(); }); } - }) - { IsBackground = true }.Start(); + }); + downloadDataThread.IsBackground = true; + downloadDataThread.Start(); + + //缃戠粶鍗¢】锛岀粓姝笅杞界嚎绋� + new System.Threading.Thread(() => { + while (beginTime.AddSeconds(6) > DateTime.Now) + { + if(DownloadDataComplete) + { + break; + } + System.Threading.Thread.Sleep(100); + } + if (DownloadDataComplete) + { + //涓嬭浇瀹屾垚鍒濆鍖栨暟鎹� + SpatialInfo.CurrentSpatial.Clear(); + + + } + else + { + downloadDataThread.Abort(); + Application.RunOnMainThread(() => { + waitPage.Hide(); + waitPage.RemoveFromParent(); + }); + } + }) { IsBackground = true }.Start(); } } } -- Gitblit v1.8.0