From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 25 七月 2024 17:25:59 +0800
Subject: [PATCH] 2024年07月25日17:24:45

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs |  120 +++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 87 insertions(+), 33 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
index 5f4966d..2278e48 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneFunctionListChoosePage.cs
@@ -57,14 +57,15 @@
         public void LoadPage()
         {
             bodyView.BackgroundColor = CSS_Color.BackgroundColor;
-            new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction)).LoadTopView();
-            //new PublicAssmebly().LoadTopView(bodyView, Language.StringByID(StringId.AddFunction));
+            var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.AddFunction));
+            topView.maginY = 10;
+            topView.LoadTopView();
 
             #region 鏄剧ず鐨勫姛鑳界被鍨嬪垏鎹㈠尯鍩�
             showdFunctionTypeRow = new FrameLayout()
             {
-                Y = Application.GetRealHeight(64),
-                Height = Application.GetRealHeight(62),
+                Y = Application.GetRealHeight(64+10),
+                Height = Application.GetRealHeight(50),
                 BackgroundColor = CSS_Color.MainBackgroundColor,
             };
             bodyView.AddChidren(showdFunctionTypeRow);
@@ -93,30 +94,14 @@
             };
             showdFunctionTypeRow.AddChidren(btnFloor);
 
-
-            //btnScreenIcon = new Button()
-            //{
-            //    Width = Application.GetMinRealAverage(16),
-            //    Height = Application.GetMinRealAverage(16),
-            //    X = Application.GetRealWidth(122),
-            //    Y = Application.GetRealHeight(18),
-            //    UnSelectedImagePath = "Public/DownIcon.png",
-            //};
-            //showdFunctionTypeRow.AddChidren(btnScreenIcon);
-
-            //btnScreenText = new Button()
-            //{
-            //    X = btnScreenIcon.Right,
-            //    Y = Application.GetRealHeight(18),
-            //    Width = Application.GetRealWidth(200),
-            //    Height = Application.GetMinRealAverage(16),
-            //    TextColor = CSS_Color.FirstLevelTitleColor,
-            //    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-            //    TextAlignment = TextAlignment.CenterLeft,
-            //    TextID = StringId.Screen
-            //};
-            //showdFunctionTypeRow.AddChidren(btnScreenText);
-
+            showdFunctionTypeRow.AddChidren(new Button()
+            {
+                Y = Application.GetRealHeight(49),
+                Gravity = Gravity.CenterHorizontal,
+                Width = Application.GetRealWidth(343),
+                Height = Application.GetRealWidth(1),
+                BackgroundColor = CSS_Color.DividingLineColor,
+            });
 
             #endregion
 
@@ -128,7 +113,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))
                 {
@@ -156,9 +145,39 @@
                 {
                     unallocatedList.Add(function);
                 }
+
+            }
+            if (string.IsNullOrEmpty(DB_ResidenceData.Instance.sceneChooseRoomId))
+            {
+                LoadFunctionListRow(null);
+            }
+            else
+            {
+                var selectedRoom = Room.CurrentSpatial.RoomList.Find((obj) => obj.uid == DB_ResidenceData.Instance.sceneChooseRoomId);
+                if (selectedRoom == null)
+                {
+                    LoadFunctionListRow(null);
+                }
+                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);
+                }
             }
 
-            LoadFunctionListRow(null);
 
             LoadEventList();
         }
@@ -166,9 +185,8 @@
         /// <summary>
         /// 鏄剧ず鍔熻兘Row
         /// </summary>
-        void LoadFunctionListRow(List<Function> functions)
+        void LoadFunctionListRow(List<Function> functions, bool isAppend = false)
         {
-            functionListView.RemoveAll();
             if (functions == null)
             {
                 //鍒濆鍊�
@@ -176,8 +194,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;
@@ -256,9 +286,32 @@
                 };
                 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>
@@ -278,6 +331,7 @@
                 form.ShowDeviceFunctionView(btnFloor, listAllFun, (selectId, listFun) =>
                 {
                     nowSelectId = selectId;
+                    DB_ResidenceData.Instance.sceneChooseRoomId = selectId;
                     //閲嶆柊鍒锋柊璁惧鍒楄〃
                     this.LoadFunctionListRow(listFun);
                 }, nowSelectId);

--
Gitblit v1.8.0