From f9181a9c8125136f597add7c30cb2ff508d54ba7 Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 25 七月 2024 17:34:32 +0800
Subject: [PATCH] 2024年07月25日17:33:40

---
 HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs |   71 ++++++++++++++++++++++++++---------
 1 files changed, 53 insertions(+), 18 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
index f1d18b8..ae70c7a 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneEditPage.cs
@@ -410,9 +410,9 @@
                 Y = Application.GetRealHeight(667 - 50),
                 Height = Application.GetRealHeight(50),
                 TextAlignment = TextAlignment.Center,
-                TextColor =  CSS_Color.WarningColor,
+                TextColor = CSS_Color.WarningColor,
                 TextSize = CSS_FontSize.SubheadingFontSize,
-                TextID =   StringId.Del,
+                TextID = StringId.Del,
                 BackgroundColor = CSS_Color.MainBackgroundColor,
                 //IsBold = true
             };
@@ -481,7 +481,6 @@
         void LoadFunctionRow()
         {
             functionListView.RemoveAll();
-            functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count);
             for(int i =0;i<scene.functions.Count;)
             {
                 var scenefunction = scene.functions[i];
@@ -490,6 +489,7 @@
                     scene.functions.Remove(scenefunction);
                     continue;
                 }
+                functionListView.Height = Application.GetRealWidth(65 * scene.functions.Count);
                 try
                 {
                     //灏唖pk瀹炰綋閲岄潰鐨刴in max鍊兼斁鍏ュ満鏅姛鑳藉疄浣撻噷锛岃涓嶇劧鏁版嵁浼氫涪澶� 2022-06-21 16:06:45
@@ -821,13 +821,21 @@
             btnOn.MouseUpEventHandler = (sender, e) =>
             {
                 dialog.Close();
-                temp = new SceneFunction();
                 temp.type = "7";
-                temp.status.Add(new SceneFunctionStatus()
+                var kv = temp.status.Find((obj) => obj.key == "enable");
+                if (kv != null)
                 {
-                    key = "enable",
-                    value = "true"
-                });
+                    kv.value = "true";
+                }
+                else
+                {
+                    temp.status.Add(new SceneFunctionStatus()
+                    {
+                        key = "enable",
+                        value = "true",
+                    });
+                }
+
                 var waitPage = new Loading();
                 bodyView.AddChidren(waitPage);
                 waitPage.Start("");
@@ -840,6 +848,10 @@
                             if (code == "0")
                             {
                                 btnTipText.TextID = StringId.OpenArm;
+                            }
+                            else
+                            {
+                                IMessageCommon.Current.ShowErrorInfoAlter(code);
                             }
                         });
                     }
@@ -860,13 +872,21 @@
             btnOff.MouseUpEventHandler = (sender, e) =>
             {
                 dialog.Close();
-                temp = new SceneFunction();
                 temp.type = "7";
-                temp.status.Add(new SceneFunctionStatus()
+
+                var kv = temp.status.Find((obj) => obj.key == "enable");
+                if (kv != null)
                 {
-                    key = "enable",
-                    value = "false"
-                });
+                    kv.value = "false";
+                }
+                else
+                {
+                    temp.status.Add(new SceneFunctionStatus()
+                    {
+                        key = "enable",
+                        value = "false",
+                    });
+                }
 
                 var waitPage = new Loading();
                 bodyView.AddChidren(waitPage);
@@ -880,6 +900,10 @@
                             if (code == "0")
                             {
                                 btnTipText.TextID = StringId.Close;
+                            }
+                            else
+                            {
+                                IMessageCommon.Current.ShowErrorInfoAlter(code);
                             }
                         });
                     }
@@ -948,11 +972,22 @@
         void LoadEvent_ChangeFunctionList()
         {
             btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => {
-                //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction);
-                var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction);
-                MainPage.BasePageView.AddChidren(sefp);
-                sefp.LoadPage();
-                MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                if (DB_ResidenceData.Instance.HomeGateway.isSupportSceneEnableAutomation)
+                {
+                    //var sefp =new SceneFunctionListChoosePage(scene,refreshFunctionRowAction);
+                    var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction);
+                    MainPage.BasePageView.AddChidren(sefp);
+                    sefp.LoadPage();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                }
+                else
+                {
+                    var sefp = new SceneFunctionListChoosePage(scene,refreshFunctionRowAction);
+                    //var sefp = new SceneTargetTypeChoosePage(scene, refreshFunctionRowAction);
+                    MainPage.BasePageView.AddChidren(sefp);
+                    sefp.LoadPage();
+                    MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+                }
             };
         }
 

--
Gitblit v1.8.0