From d297fddadd429ffffbeb3f623f5ad860c33b3e5a Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期四, 07 一月 2021 15:41:48 +0800
Subject: [PATCH] 20201-1-7-1
---
HDL_ON/Common/ApiUtlis.cs | 64 ++++++++++++++++++++-----------
1 files changed, 41 insertions(+), 23 deletions(-)
diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 069acdc..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>
@@ -64,18 +64,21 @@
if (MainPage.InternetStatus == 0)
return;
//绾跨▼寮�濮嬫椂闂�
- var beginTime = DateTime.MinValue;
+ 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)
@@ -194,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)
{
@@ -249,7 +252,8 @@
{
Application.RunOnMainThread(() =>
{
- beginTime = DateTime.Now;
+ MainPage.Log($"缁撴潫璇诲彇浜戠鏁版嵁绾跨▼");
+ endTime = DateTime.MinValue;
DownloadDataComplete = true;
waitPage.Hide();
waitPage.RemoveFromParent();
@@ -257,34 +261,48 @@
}
});
downloadDataThread.IsBackground = true;
+ downloadDataThread.Priority = System.Threading.ThreadPriority.Highest;
downloadDataThread.Start();
//缃戠粶鍗¢】锛岀粓姝笅杞界嚎绋�
- new System.Threading.Thread(() => {
- while (beginTime.AddSeconds(6) > DateTime.Now)
+ new System.Threading.Thread(() =>
+ {
+ try
{
- if(DownloadDataComplete)
+ while (endTime > DateTime.Now)
{
- break;
+ if (DownloadDataComplete)
+ {
+ break;
+ }
+ System.Threading.Thread.Sleep(100);
}
- System.Threading.Thread.Sleep(100);
- }
- if (DownloadDataComplete)
- {
- //涓嬭浇瀹屾垚鍒濆鍖栨暟鎹�
- SpatialInfo.CurrentSpatial.Clear();
-
-
- }
- else
- {
- downloadDataThread.Abort();
- Application.RunOnMainThread(() => {
+ if (!DownloadDataComplete)
+ {
+ //downloadDataThread.Abort();
+ }
+ DownloadDataComplete = true;
+ Application.RunOnMainThread(() =>
+ {
waitPage.Hide();
waitPage.RemoveFromParent();
});
+ //鍒濆鍖栨暟鎹�
+ //SpatialInfo.CurrentSpatial.Clear();
+
}
- }) { IsBackground = true }.Start();
+ catch { }
+ finally
+ {
+ #region 璇诲彇鏈湴鏁版嵁
+ //璇诲彇闊充箰淇℃伅
+ UI.Music.A31MusicModel.ReadMusicStates();
+ //鎼滅储缃戝叧
+ DriverLayer.Control.Ins.SearchLoaclGateway();
+ #endregion
+ }
+ })
+ { IsBackground = true }.Start();
}
}
}
--
Gitblit v1.8.0