From 7ff70bc7c9460c395b59952d55df6e5d6a12a718 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 15 二月 2023 16:27:32 +0800 Subject: [PATCH] Merge branch 'Dev-Wxr' --- HDL_ON/Entity/FunctionList.cs | 125 +++++++++++++++++++++++++++++++---------- 1 files changed, 93 insertions(+), 32 deletions(-) diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index 8ca1efc..f21e670 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 @@ -46,6 +62,29 @@ 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> @@ -136,15 +175,7 @@ /// </summary> public List<Function> InverterList() { - //get - //{ - // return _inverterList; - //} - //set - //{ - // _inverterList = value; - //} - return Functions.FindAll((obj) => obj.spk == SPK.Inverter); + return Functions.FindAll((obj) => obj.spk == SPK.Inverter || obj.spk == SPK.InverterRst); } #region 瀹剁數鍒楄〃 electricals /// <summary> @@ -164,7 +195,7 @@ { return Functions.FindAll((obj) => obj.spk == SPK.IrModule); } - #endregion +#endregion /// <summary> /// 闊充箰鍒楄〃 @@ -292,16 +323,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); } @@ -344,6 +383,9 @@ { MainPage.Log($"IniFunctionList error : {ex.Message}"); } + finally + { + } } /// <summary> @@ -360,25 +402,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; } @@ -394,10 +444,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> @@ -420,7 +482,6 @@ /// <summary> /// 鍒犻櫎鍦烘櫙 - /// todo /// </summary> public void DeleteScene(Scene scene,bool upSevser) { @@ -574,7 +635,7 @@ { IsBackground = true }.Start(); } - #region 鍦烘櫙鐩稿叧 +#region 鍦烘櫙鐩稿叧 /// <summary> /// 娣诲姞鍦烘櫙 /// </summary> @@ -606,9 +667,9 @@ } return revPack.Code; } - #endregion +#endregion - #region 鏀惰棌鍔熻兘 +#region 鏀惰棌鍔熻兘 /// <summary> /// 鏀惰棌鍦烘櫙 @@ -634,14 +695,14 @@ return result; } - #endregion +#endregion - #region +#region - #endregion +#endregion } } -- Gitblit v1.8.0