From c1cb2d8c6034a2ee7aa8a5710bba15b14f76cebc Mon Sep 17 00:00:00 2001
From: wjc <1243177876@qq.com>
Date: 星期五, 18 八月 2023 18:54:31 +0800
Subject: [PATCH] 2023年08月18日18:54:22

---
 HDL_ON/UI/UI2/2-Classification/FunctionPage.cs |   87 ++++++++++++++++++++++++++-----------------
 1 files changed, 52 insertions(+), 35 deletions(-)

diff --git a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
index 1b48b0d..f7fe3ad 100644
--- a/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
+++ b/HDL_ON/UI/UI2/2-Classification/FunctionPage.cs
@@ -12,7 +12,7 @@
         /// <summary>
         /// 褰撳墠绐椾綋
         /// </summary>
-        static FrameLayout bodyView;
+        public static FunctionPage bodyView;
         /// <summary>
         /// 妤煎眰閫夋嫨涓嬫媺鍥炬爣
         /// </summary>
@@ -28,15 +28,38 @@
         #endregion
 
         List<Function> functionList;
+        int titleId;
 
         public FunctionPage()
         {
             bodyView = this;
             functionList = new List<Function>();
+
         }
 
-        public void LoadPage(int titleId)
+        /// <summary>
+        /// 閲嶈浇鐣岄潰
+        /// </summary>
+        public void ReLoadPage()
         {
+            if (bodyView != null)
+            {
+                try
+                {
+                    bodyView.RemoveAll();
+                    LoadPage(this.titleId);
+                    functionList = new List<Function>();
+                }
+                catch (Exception ex)
+                {
+                    MainPage.Log($"FunctionPage ReloadPage error :\r\n {ex.Message}");
+                }
+            }
+        }
+
+        public void LoadPage(int titleId_out)
+        {
+            this.titleId = titleId_out;
 
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
             if (titleId == StringId.Lights && !DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
@@ -141,21 +164,12 @@
 
             if (titleId == StringId.Lights)
             {
-                functionList.AddRange(FunctionList.List.groupControls);
+                //functionList.AddRange(FunctionList.List.groupControls);
                 functionList.AddRange(FunctionList.List.GetLightList());
-
-
-                var lightScene = FunctionList.List.scenes.FindAll((obj) => obj.sceneType == SceneType.LightScene);
-
-                foreach (var scene in lightScene)
-                {
-                    functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
-
-                    var sceneRow = new SceneControlZone(scene);
-                    functionListView.AddChidren(sceneRow);
-                    sceneRow.LoadView();
-                }
-
+            }
+            else if(titleId == StringId.HorseRaceLamp)
+            {
+                functionList.AddRange(FunctionList.List.GetSeries());
             }
             else if (titleId == StringId.AC)
             {
@@ -172,6 +186,8 @@
             else if (titleId == StringId.Electric)
             {
                 functionList.AddRange(FunctionList.List.GetElectricals());
+                functionList.Add(new Function { spk = SPK.ElectricalTvHisense, name = "娴蜂俊鐢佃1",sid="123456789"});
+                functionList.Add(new Function { spk = SPK.ElectricalTvHisense, name = "娴蜂俊鐢佃2", sid = "1234567890" });
             }
             else if (titleId == StringId.EnvironmentalScience)
             {
@@ -185,11 +201,11 @@
             {
                 functionList.AddRange(FunctionList.List.GetAirFreshList());
             }
-            else if(titleId == StringId.MechanicalArm)
+            else if (titleId == StringId.MechanicalArm)
             {
                 functionList.AddRange(FunctionList.List.GetMechanicalArmList());
             }
-            else if(titleId == StringId.SecurityMonitoring)
+            else if (titleId == StringId.SecurityMonitoring)
             {
                 functionList.AddRange(FunctionList.List.GetIpCamImouList());
             }
@@ -200,22 +216,7 @@
             LoadDialog_ChangeFloor();
 
 
-            #region 鍔犺浇缁勫悎璋冨厜鍦烘櫙
-            if (titleId == StringId.Lights)
-            {
-                foreach (var lightScene in FunctionList.List.scenes)
-                {
-                    if (lightScene.sceneType == SceneType.LightScene)
-                        if (lightScene != null)
-                        {
-                            functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
-                            var sceneRow = new SceneControlZone(lightScene);
-                            functionListView.AddChidren(sceneRow);
-                            sceneRow.LoadView();
-                        }
-                }
-            }
-            #endregion
+        
 
         }
         /// <summary>
@@ -241,8 +242,24 @@
                         {
                             showCount = -1;
                             functionListView.RemoveAll();
+                            #region 鍔犺浇缁勫悎璋冨厜鍦烘櫙
+                            if (titleId == StringId.Lights)
+                            {
+                                foreach (var lightScene in FunctionList.List.scenes)
+                                {
+                                    if (lightScene.sceneType == SceneType.LightScene)
+                                        if (lightScene != null)
+                                        {
+                                            var sceneRow = new SceneControlZone(lightScene);
+                                            functionListView.AddChidren(sceneRow);
+                                            sceneRow.LoadView();
+                                            functionListView.AddChidren(new Button() { Height = Application.GetRealHeight(12) });
+                                        }
+                                }
+                            }
+                            #endregion
                         }
-                        for(var i = 0;i<50;i++)
+                        for (var i = 0;i<50;i++)
                         //foreach (var function in showList)
                         {
                             showCount++;

--
Gitblit v1.8.0