From a1b0a0e9ac707571a436272f41e3ee5aeef5aee2 Mon Sep 17 00:00:00 2001
From: nigel wei <nigelwei@192.168.5.223>
Date: 星期六, 31 八月 2024 19:10:47 +0800
Subject: [PATCH] 金茂定制备份

---
 HDL_ON/Common/ApiUtlis.cs |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs
index 09393f6..9a15e9a 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,12 +147,30 @@
 
                         return;
                     }
+                    else
+                    {
+                        hadInternet = true;
+                    }
                 }
                 catch (Exception ex)
                 {
                     MainPage.Log($"Error锛氫笅杞芥暟鎹�1锛歿ex.Message}");
                     DownloadDataComplete = true;
                     return;
+                }
+                finally
+                {
+                    if (!hadInternet)
+                    {
+                        Application.RunOnMainThread(() =>
+                        {
+                            if (waitPage != null)
+                            {
+                                waitPage.Hide();
+                                waitPage.RemoveFromParent();
+                            }
+                        });
+                    }
                 }
                 MainPage.Log($"杩涘叆璇诲彇浜戠鏁版嵁绾跨▼");
                 //===================鍒锋柊Token=======================
@@ -281,9 +300,8 @@
                             if (deviceResult.Code == StateCode.SUCCESS)
                             {
                                 FunctionList.List.ClearDatas();
-                                //MainPage.Log($"============璁惧============寮�濮�" + FunctionList.List.Functions.Count);
-                                //MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛");
-                                MainPage.Log($"sid鍒楄〃鑾峰彇====\r\n" , deviceResult.Data.ToString());
+                                MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛");
+                                //MainPage.Log($"sid鍒楄〃鑾峰彇====\r\n" , deviceResult.Data.ToString());
                                 var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
                                 if (deviceList == null)
                                 {

--
Gitblit v1.8.0