From cf7623fe25a008b4e128c6083e362578e2a1e3b0 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期三, 29 三月 2023 14:29:09 +0800 Subject: [PATCH] 2023年03月29日14:23:28 --- HDL_ON/Entity/FunctionList.cs | 176 +++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 143 insertions(+), 33 deletions(-) diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 9b724ca..12c46f4 100644 --- a/HDL_ON/Entity/FunctionList.cs +++ b/HDL_ON/Entity/FunctionList.cs @@ -13,6 +13,22 @@ public class FunctionList { static FunctionList _FunctionList; + + public static void ClearData() + { + try + { + _FunctionList._IpCamImou = null; + _FunctionList.ClearDatas(); + _FunctionList = null; + } + catch (Exception ex) + { + MainPage.Log($"娓呯悊FunctionList寮傚父:{ex.Message}"); + _FunctionList = null; + } + } + public static FunctionList List { get @@ -24,7 +40,11 @@ var filePathList = FileUtlis.Files.ReadFiles(); foreach (var filePath in filePathList) { - _FunctionList.IniFunctionList(filePath); + try + { + _FunctionList.IniFunctionList(filePath); + } + catch { } } #endregion } @@ -35,6 +55,57 @@ /// 鍔熻兘鍒楄〃 /// </summary> public List<Function> Functions = new List<Function>(); + /// <summary> + /// 鏈烘鑷傚垪琛� + /// </summary> + /// <returns></returns> + public List<Function> GetMechanicalArmList() + { + return Functions.FindAll((obj) => obj.spk == SPK.MechanicalArm); + } + + List<Function> _IpCamImou; + /// <summary> + /// 鑾峰彇鎽勫儚澶村垪琛� + /// </summary> + /// <returns></returns> + public List<Function> GetIpCamImouList() + { + if (_IpCamImou == null) + { + _IpCamImou = Functions.FindAll((obj) => obj.spk == SPK.IpCam_Imou); + if (_IpCamImou.Count > 0) + { +#if __IOS__ +#else + Com.Utils.HdlToLcUtils.Instance.InitData(Shared.Application.Activity, "HDL-HOME-APP-TEST", "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss", OnAppConfig.Instance.RequestHttpsHost); + Com.Utils.HdlToLcUtils.Instance.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; + Com.Utils.HdlToLcUtils.Instance.Token = UserInfo.Current.AccessToken; +#endif + } + } + return _IpCamImou; + } + + /// <summary> + /// 缁垮缓绉戞妧绯荤粺 + /// 鎬绘帶鍒楄〃 + /// </summary> + /// <returns></returns> + public List<Function> GetAcstParentList() + { + return Functions.FindAll((obj) => obj.spk == SPK.AcstParent); + } + + /// <summary> + /// 缁垮缓绉戞妧绯荤粺 + /// 瀛愭帶鍒楄〃 + /// </summary> + /// <returns></returns> + public List<Function> GetAcstSubList() + { + return Functions.FindAll((obj) => obj.spk == SPK.AcstSub); + } /// <summary> /// 绌鸿皟鍒楄〃 @@ -77,6 +148,15 @@ var spkList = SPK.GetDoorLockSPKList(); return Functions.FindAll((obj) => spkList.Contains(obj.spk)); } + /// <summary> + /// 鑾峰彇钀ょ煶瑙嗛闂ㄩ攣 + /// </summary> + /// <returns></returns> + public List<Function> GetVideoDoorLockList() + { + var spkList = SPK.GetVideoDoorLockSPKList(); + return Functions.FindAll((obj) => spkList.Contains(obj.spk)); + } /// <summary> /// 鏂伴鍒楄〃 @@ -85,15 +165,6 @@ public List<Function> GetAirFreshList() { var spkList = SPK.AirFreshSpkList(); - return Functions.FindAll((obj) => spkList.Contains(obj.spk)); - } - /// <summary> - /// 闈㈡澘鍒楄〃 - /// </summary> - /// <returns></returns> - public List<Function> GetPanelList() - { - var spkList = SPK.PanelSpkList(); return Functions.FindAll((obj) => spkList.Contains(obj.spk)); } @@ -107,6 +178,14 @@ return Functions.FindAll((obj) => spkList.Contains(obj.spk)); } + List<InverterInfo> _inverterList = new List<InverterInfo>(); + /// <summary> + /// 鍏変紡鍒楄〃 + /// </summary> + public List<Function> InverterList() + { + return Functions.FindAll((obj) => obj.spk == SPK.Inverter || obj.spk == SPK.InverterRst); + } #region 瀹剁數鍒楄〃 electricals /// <summary> /// 瀹剁數鍒楄〃 @@ -125,7 +204,7 @@ { return Functions.FindAll((obj) => obj.spk == SPK.IrModule); } - #endregion +#endregion /// <summary> /// 闊充箰鍒楄〃 @@ -253,16 +332,24 @@ if (checkRepeat == true) { //妫�娴嬮噸澶� - for (int i = 0; i < Functions.Count; i++) + var same = Functions.FindAll((obj) => obj.deviceId == tempFunction.deviceId); + if(same!= null) { - if (Functions[i].deviceId == tempFunction.deviceId) + foreach(var sameTemp in same) { - //鍏堢Щ闄ゆ帀鍐嶅姞 - Functions.RemoveAt(i); - Functions.Add(tempFunction); - return; + Functions.Remove(sameTemp); } } + //for (int i = 0; i < Functions.Count; i++) + //{ + // if (Functions[i].deviceId == tempFunction.deviceId) + // { + // //鍏堢Щ闄ゆ帀鍐嶅姞 + // Functions.RemoveAt(i); + // Functions.Add(tempFunction); + // return; + // } + //} } Functions.Add(tempFunction); } @@ -305,6 +392,9 @@ { MainPage.Log($"IniFunctionList error : {ex.Message}"); } + finally + { + } } /// <summary> @@ -321,25 +411,33 @@ switch (brandType) { case SPK.BrandType.Hdl: - foreach (var function in Functions) + try { - if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk)) + foreach (var function in Functions) { - resultFunctions.Add(function); + if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(function.spk)) + { + resultFunctions.Add(function); + } } } + catch { } break; case SPK.BrandType.Tuya: lock (Functions) { - foreach (var function in Functions) + try { - if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk)) + foreach (var function in Functions) { - resultFunctions.Add(function); + if (SPK.Get3tySpk(SPK.BrandType.Tuya).Contains(function.spk)) + { + resultFunctions.Add(function); + } } } + catch { } } break; } @@ -355,10 +453,22 @@ /// <summary> /// 娓呯┖璁惧鍔熻兘鍒楄〃 /// </summary> - public void Clear() + public void ClearDatas() { - Functions = new List<Function>(); - _FunctionList = null; + try + { + if (_IpCamImou != null) + { + _IpCamImou.Clear(); + _IpCamImou = null; + } + _FunctionList = new FunctionList(); + } + catch (Exception ex) + { + MainPage.Log($"娓呯悊FunctionList寮傚父:{ex.Message}"); + _FunctionList = null; + } } /// <summary> @@ -381,7 +491,6 @@ /// <summary> /// 鍒犻櫎鍦烘櫙 - /// todo /// </summary> public void DeleteScene(Scene scene,bool upSevser) { @@ -480,6 +589,7 @@ if (readList.Count > 9) { Control.Ins.SendReadCommand(readList); + readList.Clear(); } } if (readList.Count > 0) @@ -534,7 +644,7 @@ { IsBackground = true }.Start(); } - #region 鍦烘櫙鐩稿叧 +#region 鍦烘櫙鐩稿叧 /// <summary> /// 娣诲姞鍦烘櫙 /// </summary> @@ -566,9 +676,9 @@ } return revPack.Code; } - #endregion +#endregion - #region 鏀惰棌鍔熻兘 +#region 鏀惰棌鍔熻兘 /// <summary> /// 鏀惰棌鍦烘櫙 @@ -594,14 +704,14 @@ return result; } - #endregion +#endregion - #region +#region - #endregion +#endregion } } -- Gitblit v1.8.0