From 44aa189d9e01f8c0d19e00e44f1ef419ff2cc093 Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期四, 08 十二月 2022 22:36:38 +0800
Subject: [PATCH] 2022年12月08日22:36:36

---
 HDL_ON/Entity/FunctionList.cs |   82 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 73 insertions(+), 9 deletions(-)

diff --git a/HDL_ON/Entity/FunctionList.cs b/HDL_ON/Entity/FunctionList.cs
index 398fb08..a6882cf 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.Clear();
+                _FunctionList = null;
+            }
+            catch (Exception ex)
+            {
+                MainPage.Log($"娓呯悊FunctionList寮傚父:{ex.Message}");
+                _FunctionList = null;
+            }
+        }
+
         public static FunctionList List
         {
             get
@@ -39,6 +55,34 @@
         /// 鍔熻兘鍒楄〃
         /// </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)
+                {
+                    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;
+                }
+            }
+            return _IpCamImou;
+        }
 
         /// <summary>
         /// 缁垮缓绉戞妧绯荤粺
@@ -336,6 +380,9 @@
             {
                 MainPage.Log($"IniFunctionList error : {ex.Message}");
             }
+            finally
+            {
+            }
         }
 
         /// <summary>
@@ -352,25 +399,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;
                 }
@@ -388,8 +443,18 @@
         /// </summary>
         public void Clear()
         {
-            Functions = new List<Function>();
-            _FunctionList = null;
+            try
+            {
+                _IpCamImou.Clear();
+                _IpCamImou = null;
+                _FunctionList.Clear();
+                _FunctionList = null;
+            }
+            catch (Exception ex)
+            {
+                MainPage.Log($"娓呯悊FunctionList寮傚父:{ex.Message}");
+                _FunctionList = null;
+            }
         }
 
         /// <summary>
@@ -412,7 +477,6 @@
 
         /// <summary>
         /// 鍒犻櫎鍦烘櫙
-        /// todo
         /// </summary>
         public void DeleteScene(Scene scene,bool upSevser)
         {

--
Gitblit v1.8.0