From 5b77d9d57a6cddb474a66ca54401ad5ab0892db3 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 23 十一月 2022 14:23:42 +0800 Subject: [PATCH] Merge branch 'dev--wxr' into LcSdkV1 --- HDL_ON/Common/ApiUtlis.cs | 86 ++++++++++++++----------------------------- 1 files changed, 28 insertions(+), 58 deletions(-) diff --git a/HDL_ON/Common/ApiUtlis.cs b/HDL_ON/Common/ApiUtlis.cs index 8369a48..eb7f100 100644 --- a/HDL_ON/Common/ApiUtlis.cs +++ b/HDL_ON/Common/ApiUtlis.cs @@ -5,6 +5,7 @@ using HDL_ON.DAL.Server; using HDL_ON.Entity; using HDL_ON.UI.UI2.FuntionControlView.Video; +using HDL_ON.UI.UI2.Intelligence.Automation; using Newtonsoft.Json; using Shared; @@ -50,6 +51,8 @@ /// 璇诲彇鍦烘櫙鏁版嵁瀹屾垚 /// </summary> bool complateScene = false; + //绾跨▼缁撴潫鏃堕棿 + DateTime endTime1; /// <summary> /// 鏍¢獙缃戝叧鏄惁鍦ㄧ嚎 @@ -68,7 +71,7 @@ /// <summary> /// 涓嬭浇鏁版嵁瀹屾垚鏍囪 /// </summary> - public bool DownloadDataComplete = true; + public bool DownloadDataComplete = false; /// <summary> /// 涓嬭浇鏁版嵁 /// </summary> @@ -76,8 +79,8 @@ { if (MainPage.InternetStatus == 0 || MainPage.NoLoginMode) return; - //绾跨▼寮�濮嬫椂闂� - var endTime = DateTime.Now.AddSeconds(5); + endTime1 = DateTime.Now.AddSeconds(25); + complateDevice = complateScene = false; MainPage.Log($"寮�濮嬪悓姝ヤ簯绔暟鎹�"); @@ -101,7 +104,6 @@ MainPage.Log($"鍒锋柊token澶辫触"); return; } - endTime = DateTime.Now.AddSeconds(5); MainPage.Log($"鍒锋柊token鎴愬姛"); //===================鍒锋柊浣忓畢淇℃伅======================= code = Ins.HttpRequest.GetHomePager(); @@ -110,7 +112,6 @@ MainPage.Log($"鍒锋柊浣忓畢淇℃伅澶辫触"); return; } - endTime = DateTime.Now.AddSeconds(5); MainPage.Log($"鍒锋柊浣忓畢淇℃伅鎴愬姛"); //===================鍒锋柊涓汉淇℃伅======================= code = Ins.HttpRequest.GetUserInfo(); @@ -119,7 +120,6 @@ MainPage.Log($"鍒锋柊涓汉淇℃伅澶辫触"); return; } - endTime = DateTime.Now.AddSeconds(5); MainPage.Log($"鍒锋柊涓汉淇℃伅鎴愬姛"); //int count = 0; @@ -147,7 +147,6 @@ var roomResult = Ins.HttpRequest.GetRoomList(); if (roomResult.Code == StateCode.SUCCESS) { - endTime = DateTime.Now.AddSeconds(100); MainPage.Log($"璇诲彇鎴块棿淇℃伅鎴愬姛"); var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<SpatialApiPack>(roomResult.Data.ToString()); if (revData == null) @@ -157,7 +156,6 @@ { SpatialInfo.CurrentSpatial.UpdateSpatialList(revData.list); } - endTime = DateTime.Now.AddSeconds(5); } else { @@ -173,11 +171,10 @@ var deviceResult = Ins.HttpRequest.GetDeviceList("30", "1"); if (deviceResult.Code == StateCode.SUCCESS) { - endTime = DateTime.Now.AddSeconds(5); - MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛"); - MainPage.Log($"sid鍒楄〃鑾峰彇====" + deviceResult.Data.ToString()); - var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); + //MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛"); + //MainPage.Log($"sid鍒楄〃鑾峰彇====" + deviceResult.Data.ToString()); + var deviceList = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); if (deviceList == null) { deviceList = new DevcieApiPack(); @@ -189,7 +186,7 @@ var deviceResult2 = Ins.HttpRequest.GetDeviceList("30", Convert.ToInt32(deviceList.pageNo) + 1 + ""); if (deviceResult2.Code == StateCode.SUCCESS) { - var deviceList2 = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); + var deviceList2 = JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString()); deviceList.pageNo = deviceList2.pageNo; deviceList.list.AddRange(deviceList2.list); } @@ -197,11 +194,10 @@ } catch (Exception ex) { - } finally { - complateDevice = true; + } string delFile = ""; @@ -228,13 +224,14 @@ } } //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳� + int iiii = 0; foreach (var newFunction in deviceList.list) { newFunction.AssembleStatus(); newFunction.SaveFunctionFile(); FunctionList.List.IniFunctionList(newFunction.savePath); + MainPage.Log($"============璁惧============{iiii++}"); } - endTime = DateTime.Now.AddSeconds(5); } else { @@ -247,6 +244,7 @@ finally { complateDevice = true; + MainPage.Log($"============璁惧============瀹屾垚" + FunctionList.List.Functions.Count); } }) { IsBackground = true }.Start(); @@ -256,11 +254,10 @@ { try { - complateScene = true; + complateScene = false; var pack = Ins.HttpRequest.GetSceneList(); if (pack.Code == StateCode.SUCCESS) { - endTime = DateTime.Now.AddSeconds(100); MainPage.Log($"璇诲彇鍦烘櫙鏁版嵁鎴愬姛"); var sceneList = JsonConvert.DeserializeObject<List<Scene>>(pack.Data.ToString()); if (sceneList == null) @@ -302,7 +299,6 @@ IMessageCommon.Current.ShowErrorInfoAlter(packInfo.Code); } } - endTime = DateTime.Now.AddSeconds(5); } else { @@ -320,7 +316,8 @@ { IsBackground = true }.Start(); //===================璇诲彇閫昏緫鍒楄〃========================== - UI.UI2.Intelligence.Automation.MainView.GetLogicList(true); + Logic.LogicList.Clear();//涓婚〉涓嬫媺寮哄埗鍒锋柊鑷姩鍖栧垪琛� + //UI.UI2.Intelligence.Automation.MainView.GetLogicList(); //===================璇诲彇鍙瀵硅鏁版嵁========================== //鍒ゆ柇鏄惁鏈夊彲瑙嗗璁叉暟鎹紝鏈夊垯鏄剧ず鍙瀵硅icon @@ -350,10 +347,10 @@ DB_ResidenceData.Instance.SaveResidenceData(); Entity.DB_ResidenceData.Instance.SupportFVDevice = true; - } else if (video.interphoneType == InterphoneType.FREEVIEW.ToString()) - {//涓哄叏瑙嗛�氬彲瑙嗗璁� + { + //涓哄叏瑙嗛�氬彲瑙嗗璁� DB_ResidenceData.Instance.SupportFacePass = true; Entity.DB_ResidenceData.Instance.SupportVisitorManage = true; Entity.DB_ResidenceData.Instance.SupportFVDevice = true; @@ -419,8 +416,6 @@ Application.RunOnMainThread(() => { MainPage.Log($"缁撴潫璇诲彇浜戠鏁版嵁绾跨▼"); - endTime = DateTime.MinValue; - DownloadDataComplete = true; if (waitPage != null) { waitPage.RemoveFromParent(); @@ -430,7 +425,13 @@ //涓嶈�冭檻缃戝叧鎯呭喌锛岀洿鎺ヨ闃� DAL.Mqtt.MqttClient.InitState(); - FunctionList.List.Read3tyFunctionStatus(); + try + { + FunctionList.List.Read3tyFunctionStatus(); + }catch(Exception ex) + { + MainPage.Log("璇诲彇绗笁鏂硅澶囩姸鎬佸け璐�:"+ex.Message); + } } }); downloadDataThread.IsBackground = true; @@ -442,9 +443,9 @@ { try { - while (endTime > DateTime.Now) + while (endTime1 > DateTime.Now) { - if (DownloadDataComplete && complateDevice && complateScene) + if ( complateDevice && complateScene) { break; } @@ -476,37 +477,6 @@ } }) { IsBackground = true }.Start(); - - - - - ////涓嬭浇鍏変紡鏁版嵁 - //new System.Threading.Thread(() => { - // try - // {//00 - // HttpServerRequest http = new HttpServerRequest(); - // var packData = http.GetInverterList(); - // if (packData != null) - // { - // if (packData.Code == StateCode.SUCCESS) - // { - // var inverterList = JsonConvert.DeserializeObject<List<InverterInfo>>(packData.Data.ToString()); - // if (inverterList!= null) - // { - // FunctionList.List.InverterList = inverterList; - // } - // } - // } - // } - // catch (Exception ex) - // { - // MainPage.Log($"璇诲彇鍏変紡鏁版嵁寮傚父:{ex.Message}"); - // } - - //}) { IsBackground = true }.Start(); - - - } /// <summary> -- Gitblit v1.8.0