From f46be160caed45c67e8980173d29ed48d525a4d3 Mon Sep 17 00:00:00 2001 From: wjc <1243177876@qq.com> Date: 星期二, 28 三月 2023 14:49:52 +0800 Subject: [PATCH] 2023年03月28日14:49:50 --- HDL_ON/Entity/FunctionList.cs | 114 ++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 88 insertions(+), 26 deletions(-) diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs index cdd06aa..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 @@ -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> @@ -109,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> /// 鏂伴鍒楄〃 @@ -136,15 +184,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 +204,7 @@ { return Functions.FindAll((obj) => obj.spk == SPK.IrModule); } - #endregion +#endregion /// <summary> /// 闊充箰鍒楄〃 @@ -292,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); } @@ -343,6 +391,9 @@ catch (Exception ex) { MainPage.Log($"IniFunctionList error : {ex.Message}"); + } + finally + { } } @@ -402,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> @@ -428,7 +491,6 @@ /// <summary> /// 鍒犻櫎鍦烘櫙 - /// todo /// </summary> public void DeleteScene(Scene scene,bool upSevser) { @@ -582,7 +644,7 @@ { IsBackground = true }.Start(); } - #region 鍦烘櫙鐩稿叧 +#region 鍦烘櫙鐩稿叧 /// <summary> /// 娣诲姞鍦烘櫙 /// </summary> @@ -614,9 +676,9 @@ } return revPack.Code; } - #endregion +#endregion - #region 鏀惰棌鍔熻兘 +#region 鏀惰棌鍔熻兘 /// <summary> /// 鏀惰棌鍦烘櫙 @@ -642,14 +704,14 @@ return result; } - #endregion +#endregion - #region +#region - #endregion +#endregion } } -- Gitblit v1.8.0