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/FuntionControlView/Light/LightScene/AddLightScene.cs |  168 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 86 insertions(+), 82 deletions(-)

diff --git a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
index c908e90..746471b 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/Light/LightScene/AddLightScene.cs
@@ -194,7 +194,7 @@
         /// <summary>
         /// 鏄剧ず鐨勮澶囩殑鎬绘暟
         /// </summary>
-        int showCount = 0;
+        int showCount = -1;
 
         /// <summary>
         /// 鍔犺浇鍔熻兘row
@@ -214,18 +214,19 @@
                     {
                         if (!isAppend)
                         {
-                            showCount = 0;
+                            showCount = -1;
                             functionListView.RemoveAll();
                         }
-                        int i = 0;
-                        foreach (var function in functions)
+                        for(var i =0;i<100;i++)
+                        //foreach (var function in functions)
                         {
-                            i++;
-                            if (i > 100)
+                            showCount++;
+                            if (showCount >= functions.Count)
                             {
                                 break;
                             }
-                            showCount++;
+                            var function = functions[showCount];
+
                             var functionDiv = new LightRow(function)
                             {
                                 Gravity = Gravity.CenterHorizontal,
@@ -264,12 +265,8 @@
                                 TextAlignment = TextAlignment.Center,
                                 TextSize = CSS_FontSize.SubheadingFontSize,
                                 TextColor = CSS_Color.FirstLevelTitleColor,
-                                Text = "鍔犺浇鏇村",
+                                TextID = StringId.LoadMore,
                             };
-                            if (Language.CurrentLanguage != "Chinese")
-                            {
-                                btnAppend.Text = "Load more";
-                            }
                             functionListView.AddChidren(btnAppend);
                             btnAppend.MouseUpEventHandler = (sender, e) =>
                             {
@@ -375,84 +372,91 @@
         /// </summary>
         public void LoadDiv(List<Function> functions,Action action)
         {
-            btnIcon = new Button()
+            try
             {
-                X = Application.GetRealWidth(10),
-                Y = Application.GetRealHeight(15),
-                Width = Application.GetRealWidth(32),
-                Height = Application.GetRealWidth(32),
-                UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"
-            };
-            bodyDiv.AddChidren(btnIcon);
-
-            btnName = new Button()
-            {
-                X = Application.GetRealWidth(8 + 10 + 32),
-                Y = Application.GetRealHeight(10),
-                Width = Application.GetRealWidth(200),
-                Height = Application.GetRealHeight(24),
-                Text = function.name,
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = CSS_Color.FirstLevelTitleColor,
-                TextSize = CSS_FontSize.TextFontSize,
-            };
-            bodyDiv.AddChidren(btnName);
-
-            btnFromFloor = new Button()
-            {
-                X = Application.GetRealWidth(8 + 10 + 32),
-                Y = Application.GetRealHeight(10 + 24),
-                Width = Application.GetRealWidth(200),
-                Height = Application.GetRealHeight(18),
-                Text = function.GetRoomListName(),
-                TextAlignment = TextAlignment.CenterLeft,
-                TextColor = CSS_Color.PromptingColor1,
-                TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
-            };
-            bodyDiv.AddChidren(btnFromFloor);
-
-            btnSelect = new Button()
-            {
-                X = Application.GetRealWidth(303),
-                Gravity = Gravity.CenterVertical,
-                Width = Application.GetRealWidth(32),
-                Height = Application.GetRealWidth(32),
-                UnSelectedImagePath = "FunctionIcon/Light/LightScene/CheckIcon.png",
-                SelectedImagePath = "FunctionIcon/Light/LightScene/CheckOnIcon.png",
-                IsSelected = functions.Find((obj) => obj.deviceId == function.deviceId) != null
-            };
-            if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
-            {
-                btnSelect.X = Application.GetRealWidth(323);
-            }
-            bodyDiv.AddChidren(btnSelect);
-            
-            btnSelect.MouseUpEventHandler = (sender, e) => {
-                Application.HideSoftInput();
-                btnSelect.IsSelected = !btnSelect.IsSelected;
-                if(btnSelect.IsSelected)
+                btnIcon = new Button()
                 {
-                    var addTemp = functions.Find((obj) => obj.deviceId == function.deviceId);
-                    if (addTemp == null)
-                    {
-                        functions.Add(function);
-                    }
+                    X = Application.GetRealWidth(10),
+                    Y = Application.GetRealHeight(15),
+                    Width = Application.GetRealWidth(32),
+                    Height = Application.GetRealWidth(32),
+                    UnSelectedImagePath = $"FunctionIcon/Icon/{function.IconName}.png"
+                };
+                bodyDiv.AddChidren(btnIcon);
+
+                btnName = new Button()
+                {
+                    X = Application.GetRealWidth(8 + 10 + 32),
+                    Y = Application.GetRealHeight(10),
+                    Width = Application.GetRealWidth(200),
+                    Height = Application.GetRealHeight(24),
+                    Text = function.name,
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.FirstLevelTitleColor,
+                    TextSize = CSS_FontSize.TextFontSize,
+                };
+                bodyDiv.AddChidren(btnName);
+
+                btnFromFloor = new Button()
+                {
+                    X = Application.GetRealWidth(8 + 10 + 32),
+                    Y = Application.GetRealHeight(10 + 24),
+                    Width = Application.GetRealWidth(200),
+                    Height = Application.GetRealHeight(18),
+                    Text = function.GetRoomListName(),
+                    TextAlignment = TextAlignment.CenterLeft,
+                    TextColor = CSS_Color.PromptingColor1,
+                    TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+                };
+                bodyDiv.AddChidren(btnFromFloor);
+
+                btnSelect = new Button()
+                {
+                    X = Application.GetRealWidth(303),
+                    Gravity = Gravity.CenterVertical,
+                    Width = Application.GetRealWidth(32),
+                    Height = Application.GetRealWidth(32),
+                    UnSelectedImagePath = "FunctionIcon/Light/LightScene/CheckIcon.png",
+                    SelectedImagePath = "FunctionIcon/Light/LightScene/CheckOnIcon.png",
+                    IsSelected = functions.Find((obj) => obj.deviceId == function.deviceId) != null,
+                    Tag = "ChooseIcon"
+                };
+                if (DB_ResidenceData.Instance.HomeGateway.isSupportGroupControl)
+                {
+                    btnSelect.X = Application.GetRealWidth(323);
                 }
-                else
+                bodyDiv.AddChidren(btnSelect);
+
+                btnSelect.MouseUpEventHandler = (sender, e) =>
                 {
-                    var removeTemp = functions.Find((obj) => obj.deviceId == function.deviceId);
-                    if (removeTemp != null)
+                    Application.HideSoftInput();
+                    btnSelect.IsSelected = !btnSelect.IsSelected;
+                    if (btnSelect.IsSelected)
                     {
-                        functions.Remove(removeTemp);
+                        var addTemp = functions.Find((obj) => obj.deviceId == function.deviceId);
+                        if (addTemp == null)
+                        {
+                            functions.Add(function);
+                        }
                     }
-                }
-                ///鍒锋柊鐣岄潰
-                if (functions.Count == 0 || functions.Count == 1)
-                {
+                    else
+                    {
+                        var removeTemp = functions.Find((obj) => obj.sid == function.sid);
+                        if (removeTemp != null)
+                        {
+                            functions.Remove(removeTemp);
+                        }
+                    }
+                    ///鍒锋柊鐣岄潰
+                    //if (functions.Count == 0 || functions.Count == 1)
+                    //{
                     action();
-                }
-            };
+                    //}
+                };
+            }catch (Exception ex)
+            {
 
+            }
         }
 
 

--
Gitblit v1.8.0