From 58beee272e47fdbf814e0c8fe625e09c5b844d4d Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期三, 23 十二月 2020 13:38:27 +0800 Subject: [PATCH] Merge branch 'NewFilePath' into CJL --- HDL_ON/Common/ApiUtlis.cs | 66 +++++++++++++++++++++++++++++--- 1 files changed, 59 insertions(+), 7 deletions(-) diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index c564f63..24eac42 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -55,7 +55,7 @@ return result; } - public bool DownloadDataComplete = false; + public bool DownloadDataComplete = true; /// <summary> /// 涓嬭浇鏁版嵁 /// </summary> @@ -63,19 +63,25 @@ { if (MainPage.InternetStatus == 0) return; + //绾跨▼寮�濮嬫椂闂� + 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; - new System.Threading.Thread(() => { + var downloadDataThread = new System.Threading.Thread(() => + { + MainPage.Log($"杩涘叆璇诲彇浜戠鏁版嵁绾跨▼"); //===================鍒锋柊Token======================= code = Ins.HttpRequest.RefreshToken(); - if(code != StateCode.SUCCESS) + if (code != StateCode.SUCCESS) { MainPage.Log($"鍒锋柊token澶辫触"); return; @@ -191,7 +197,7 @@ var pack = Ins.HttpRequest.GetSceneList(); if (pack.Code == StateCode.SUCCESS) { - MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛");//:\r\n{pack.Data.ToString()}"); + MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛"); var sceneList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString()); if (sceneList != null) { @@ -237,18 +243,64 @@ //===================璇诲彇閫昏緫鍒楄〃========================== UI.UI2.Intelligence.Automation.MainView.GetLogicList(); - }catch(Exception ex) + } + catch (Exception ex) { MainPage.Log($"鏁版嵁鍒濆鍖栧け璐ワ細{ex.Message}"); } finally { - Application.RunOnMainThread(() => { + Application.RunOnMainThread(() => + { + MainPage.Log($"缁撴潫璇诲彇浜戠鏁版嵁绾跨▼"); + endTime = DateTime.MinValue; DownloadDataComplete = true; waitPage.Hide(); waitPage.RemoveFromParent(); }); } + }); + downloadDataThread.IsBackground = true; + downloadDataThread.Priority = System.Threading.ThreadPriority.Highest; + downloadDataThread.Start(); + + //缃戠粶鍗¢】锛岀粓姝笅杞界嚎绋� + new System.Threading.Thread(() => + { + try + { + while (endTime > DateTime.Now) + { + if (DownloadDataComplete) + { + break; + } + System.Threading.Thread.Sleep(100); + } + 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