From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期四, 25 七月 2024 17:25:59 +0800 Subject: [PATCH] 2024年07月25日17:24:45 --- HDL_ON/Common/ApiUtlis.cs | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 deletions(-) diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 09393f6..edc5d3a 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -72,6 +72,8 @@ /// 涓嬭浇鏁版嵁瀹屾垚鏍囪 /// </summary> public bool DownloadDataComplete = false; + + public bool hadInternet = true; /// <summary> /// 涓嬭浇鏁版嵁 /// </summary> @@ -97,20 +99,19 @@ string code = StateCode.SUCCESS; Inverter.Ins.H5Page = null;//閲嶇疆鍏変紡椤甸潰 - var downloadDataThread = new System.Threading.Thread(() => { try { //澧炲姞3绉掍簯鏈嶅姟鍣ㄨ繛鎺ユ娴嬶紝杩炰笉涓婃湇鍔″櫒鐨勬椂鍊欎笉鍒锋柊鏁版嵁 + hadInternet = true; var dataList = new List<GlobalRegionListRes>(); var requestJson = HttpUtil.GetSignRequestJson(new GetRegionListObj() { regionMark = HttpUtil.RegionMark }); - Console.WriteLine(DateTime.Now); - var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost,"",3); - Console.WriteLine(DateTime.Now); + var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_GlobalRegionList, requestJson, HttpUtil.GlobalRequestHttpsHost, "", 3); if (revertObj == null || revertObj.Code != StateCode.SUCCESS) { DownloadDataComplete = true; + hadInternet = false; try { var spatialInfoDataBytes = FileUtlis.Files.ReadFile("SpatialInfoData"); @@ -146,6 +147,10 @@ return; } + else + { + hadInternet = true; + } } catch (Exception ex) { @@ -153,6 +158,20 @@ DownloadDataComplete = true; return; } + finally + { + if (!hadInternet) + { + Application.RunOnMainThread(() => + { + if (waitPage != null) + { + waitPage.Hide(); + waitPage.RemoveFromParent(); + } + }); + } + } MainPage.Log($"杩涘叆璇诲彇浜戠鏁版嵁绾跨▼"); //===================鍒锋柊Token======================= code = Ins.HttpRequest.RefreshToken(); -- Gitblit v1.8.0