From 2f05a4874e64b3c2e60055e1246025f8a0367f78 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 15 三月 2021 17:53:09 +0800 Subject: [PATCH] 红外宝最终版本 --- HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs | 57 +++++++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 47 insertions(+), 10 deletions(-) diff --git a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs index de75ae9..6a725c7 100644 --- a/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs +++ b/HDL_ON/UI/UI2/4-PersonalCenter/AddDevice/AddMiniRemoteControlDirection4Page.cs @@ -317,13 +317,49 @@ /// <summary> /// 鍒锋柊绾㈠瀹濅俊鎭� /// </summary> - private void RefreshMiniRemoteControlInfo() + /// <param name="successEvent">鎴愬姛鐨勫洖璋冧簨浠�</param> + private void RefreshMiniRemoteControlInfo(Action successEvent) { var pra = new Dictionary<string, object>(); pra.Add("homeId", Entity.DB_ResidenceData.Instance.CurrentRegion.RegionID); + pra.Add("spk", Entity.SPK.IrModule); var requestJson = DAL.Server.HttpUtil.GetSignRequestJson(pra); - DAL.Server.HttpUtil.RequestHttpsPostFroHome(DAL.Server.NewAPI.Api_Post_GetDevcieList, requestJson); + HdlThreadLogic.Current.RunThread(() => + { + int count = 0; + while (this.Parent != null) + { + try + { + //瓒呰繃5娆¢兘涓嶆垚鍔�,鐪熶笉澶勭悊浜� + count++; + if (count > 5) { return; } + + //鑾峰彇鍏ㄩ儴绾㈠瀹濆垪琛� + var result = DAL.Server.HttpUtil.RequestHttpsPostFroHome(DAL.Server.NewAPI.Api_Post_GetDevcieList, requestJson); + if (result == null || result.Code != DAL.Server.StateCode.SUCCESS) + { + System.Threading.Thread.Sleep(3000); + continue; + } + var listDevice = Newtonsoft.Json.JsonConvert.DeserializeObject<Entity.DevcieApiPack>(result.Data.ToString()); + foreach (var newFunction in listDevice.list) + { + //娣诲姞鍒扮紦瀛樺綋涓� + newFunction.SaveFunctionFile(); + Entity.FunctionList.List.IniFunctionList(newFunction.savePath, true); + } + //璋冪敤鍥炶皟鍑芥暟 + successEvent?.Invoke(); + return; + } + catch + { + System.Threading.Thread.Sleep(3000); + } + } + }); } #endregion @@ -343,15 +379,16 @@ return; } //鍒锋柊绾㈠瀹濅俊鎭� - this.RefreshMiniRemoteControlInfo(); + this.RefreshMiniRemoteControlInfo(() => + { + //绉婚櫎杩欎釜浜嬩欢 + HdlCloudReceiveLogic.Current.RemoveCloudReceiveEvent("AddMiniRemoteControlDirection4Page"); + //鍋滄绾跨▼ + this.timeoutThreadActivity = false; - //鎺ユ敹鍒板氨绉婚櫎杩欎釜浜嬩欢 - HdlCloudReceiveLogic.Current.RemoveCloudReceiveEvent("AddMiniRemoteControlDirection4Page"); - //鍋滄绾跨▼ - this.timeoutThreadActivity = false; - - //娣诲姞璁惧鎴愬姛涔嬪悗,澶勭悊涓�浜涗笢瑗� - this.DoSomethingAfterAddDeviceSuccess(); + //娣诲姞璁惧鎴愬姛涔嬪悗,澶勭悊涓�浜涗笢瑗� + this.DoSomethingAfterAddDeviceSuccess(); + }); } /// <summary> -- Gitblit v1.8.0