From 54c202bd4867092fca2bc6f96bec0cfd1056a46a Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期一, 06 十一月 2023 11:24:20 +0800
Subject: [PATCH] 2023年11月06日11:23:46

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs |   78 ++++++++++++++++++++++++++++++--------
 1 files changed, 61 insertions(+), 17 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
index 8f089d6..c0f6581 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
@@ -128,7 +128,11 @@
             };
             bodyView.AddChidren(functionListView);
 
-            foreach (var function in FunctionList.List.Functions)
+            List<Function> showList = new List<Function>();
+            showList.AddRange(FunctionList.List.Functions);
+            showList.AddRange(FunctionList.List.groupControls);
+
+            foreach (var function in showList)
             {
                 if (!MainPage.SceneSupportFunctionList.Contains(function.spk))
                 {
@@ -165,22 +169,28 @@
             else
             {
                 var selectedRoom = Room.CurrentSpatial.RoomList.Find((obj) => obj.uid == DB_ResidenceData.Instance.sceneChooseRoomId);
-
-                var listAllFun = new List<Function>();
-                var listFun = new List<Function>();
-                listAllFun.AddRange(unallocatedList);
-                listAllFun.AddRange(allocatedList);
-
-                btnFloor.Text = selectedRoom.floorRoomName;
-                foreach(var funtion in listAllFun)
+                if (selectedRoom == null)
                 {
-                    if (funtion.roomIds.Contains(selectedRoom.roomId))
-                    {
-                        listFun.Add(funtion);
-                    }
+                    LoadFunctionListRow(null);
                 }
-                LoadFunctionListRow(listFun);
+                else
+                {
 
+                    var listAllFun = new List<Function>();
+                    var listFun = new List<Function>();
+                    listAllFun.AddRange(unallocatedList);
+                    listAllFun.AddRange(allocatedList);
+
+                    btnFloor.Text = selectedRoom.floorRoomName;
+                    foreach (var funtion in listAllFun)
+                    {
+                        if (funtion.roomIds.Contains(selectedRoom.roomId))
+                        {
+                            listFun.Add(funtion);
+                        }
+                    }
+                    LoadFunctionListRow(listFun);
+                }
             }
 
 
@@ -190,9 +200,8 @@
         /// <summary>
         /// 鏄剧ず鍔熻兘Row
         /// </summary>
-        void LoadFunctionListRow(List<Function> functions)
+        void LoadFunctionListRow(List<Function> functions, bool isAppend = false)
         {
-            functionListView.RemoveAll();
             if (functions == null)
             {
                 //鍒濆鍊�
@@ -200,8 +209,20 @@
                 functions.AddRange(unallocatedList);
                 functions.AddRange(allocatedList);
             }
-            foreach (var function in functions)
+            if (!isAppend)
             {
+                showCount = -1;
+                functionListView.RemoveAll();
+            }
+            for (var i = 0; i < 100; i++)
+            //foreach (var function in functions)
+            {
+                showCount++;
+                if (showCount >= functions.Count)
+                {
+                    break;
+                }
+                var function = functions[showCount];
                 if (!MainPage.SceneSupportFunctionList.Contains(function.spk))
                 {
                     continue;
@@ -280,10 +301,33 @@
                 };
                 functionRow.AddChidren(btnChooseIcon);
                 LoadEvent_SkipEditFunctionInfo(functionRow, btnFunctionFloorName, btnChooseIcon, btnFunctionName, function);
+
+            }
+            if (functions.Count > showCount)
+            {
+                var btnAppend = new Button()
+                {
+                    Height = Application.GetRealHeight(60),
+                    TextAlignment = TextAlignment.Center,
+                    TextSize = CSS_FontSize.SubheadingFontSize,
+                    TextColor = CSS_Color.FirstLevelTitleColor,
+                    TextID = StringId.LoadMore,
+                };
+                functionListView.AddChidren(btnAppend);
+                btnAppend.MouseUpEventHandler = (sender, e) =>
+                {
+                    btnAppend.RemoveFromParent();
+                    LoadFunctionListRow(functions, true);
+                };
             }
 
         }
 
+        /// <summary>
+        /// 鏄剧ず鐨勮澶囩殑鎬绘暟
+        /// </summary>
+        int showCount = -1;
+
 
         /// <summary>
         /// 浣忓畢鍒楄〃鐐瑰嚮浜嬩欢

--
Gitblit v1.8.0