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/SetSceneFunctionInfoPage.cs |  140 +++++++++++++++++++++-------------------------
 1 files changed, 63 insertions(+), 77 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
index 54bcda7..4713ac2 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -32,7 +32,7 @@
             
             bodyView = this;
             scene = s;
-            sceneFunction = fc.localFunction.ConvertSceneFunction(); 
+            sceneFunction = fc;//.localFunction.ConvertSceneFunction(); 
             foreach (var ll in sceneFunction.status)
             {
                 try
@@ -79,13 +79,13 @@
 
             if (sceneFunction.localFunction.spk == SPK.LightRGB || sceneFunction.localFunction.spk == SPK.GroupControl)
             {
-                //var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
-                //if (colorfulStatus != null)
-                //{
-                //    isColorful = true;
-                //    LoadColorfulRow(colorfulStatus);
-                //    isColorful = colorfulStatus.value == "on";
-                //}
+                var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
+                if (colorfulStatus != null)
+                {
+                    isColorful = true;
+                    LoadColorfulRow(colorfulStatus);
+                    isColorful = colorfulStatus.value == "on";
+                }
             }
             foreach (var attr in sceneFunction.status)
             {
@@ -193,10 +193,33 @@
                         }
                         else
                         {
-                            var isHasColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
-                            if (isHasColorful != null)
+                            if (sceneFunction.localFunction.spk == SPK.ElectricalTvHisense)
                             {
-                                sceneFunction.status.Remove(isHasColorful);
+                                for(int i = 0;i< sceneFunction.status.Count;i++)
+                                {
+                                    var tvState = sceneFunction.status[i];
+                                    if (tvState.key == FunctionAttributeKey.OnOff)
+                                    {
+                                        tvState.key = "wol";
+                                        tvState.value = "on";
+                                    }
+                                    else
+                                    {
+                                        if(string.IsNullOrEmpty( tvState.value))
+                                        {
+                                            sceneFunction.status.RemoveAt(i);
+                                            i--;
+                                        }
+                                    }
+                                }
+                            }
+                            else
+                            {
+                                var isHasColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
+                                if (isHasColorful != null)
+                                {
+                                    sceneFunction.status.Remove(isHasColorful);
+                                }
                             }
                         }
                     }
@@ -206,6 +229,7 @@
                         {
                             sceneFunction.status.Clear();
                             sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "off" });
+                            sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.Delay, value = sceneFunction.delay });
                         }
                     }
                 }
@@ -215,16 +239,6 @@
                 {
                     if (temp != null)
                     {
-                        //temp.delay = sceneFunction.delay;
-                        //foreach (var attr in sceneFunction.status)
-                        //{
-                        //    var keva = temp.status.Find((obj) => obj.key == attr.key);
-                        //    if (keva != null)
-                        //    {
-                        //        keva.value = attr.value;
-                        //    }
-                        //}
-                        //temp = sceneFunction;
                         scene.functions.Remove(temp);
                     }
                     //else
@@ -269,7 +283,14 @@
 
         void UpdataFunctionRow()
         {
-            contentView.RemoveAll();
+            try
+            {
+                contentView.RemoveAll();
+            }
+            catch (Exception ex)
+            {
+                MainPage.Log(ex.Message);
+            }
             for (var i = 0; i < functionRowList.Count; i++)
             {
                 try
@@ -281,37 +302,39 @@
                         {
                             if (view.Tag != null)
                             {
-                                if (view.Tag.ToString() == FunctionAttributeKey.OnOff)
+                                if (view.Tag.ToString() == FunctionAttributeKey.OnOff || view.Tag.ToString() == "delay")
                                 {
                                     contentView.AddChidren(view);
-
                                 }
-                                if (isOnStatus)
+                                else
                                 {
-                                    if (view.Tag.ToString() != FunctionAttributeKey.OnOff)
+                                    if (isOnStatus)
                                     {
-                                        if (isColorful && sceneFunction.localFunction.spk == SPK.LightRGB)
+                                        if (view.Tag.ToString() != FunctionAttributeKey.OnOff)
                                         {
-                                            if (view.Tag.ToString() != FunctionAttributeKey.Colorful)
+                                            if (isColorful && sceneFunction.localFunction.spk == SPK.LightRGB)
                                             {
-                                                view.RemoveFromParent();
+                                                if (view.Tag.ToString() != FunctionAttributeKey.Colorful)
+                                                {
+                                                    view.RemoveFromParent();
+                                                }
+                                                else
+                                                {
+                                                    contentView.AddChidren(view);
+                                                }
                                             }
                                             else
                                             {
                                                 contentView.AddChidren(view);
                                             }
                                         }
-                                        else
-                                        {
-                                            contentView.AddChidren(view);
-                                        }
                                     }
-                                }
-                                else
-                                {
-                                    if (view.Tag.ToString() != FunctionAttributeKey.OnOff)
+                                    else
                                     {
-                                        view.RemoveFromParent();
+                                        if (view.Tag.ToString() != FunctionAttributeKey.OnOff && view.Tag.ToString() != "delay")
+                                        {
+                                            view.RemoveFromParent();
+                                        }
                                     }
                                 }
                             }
@@ -555,7 +578,7 @@
                             {
                                 btnFunctionText.Text = song.name;
                                 sceneStatus.value = song.name;
-                                //杩藉姞鎺у埗灞炴��
+                                //杩藉姞灞炴��
                                 var oldList = new List<SceneFunctionStatus>();
                                 for (int i = 0; i < sceneFunction.status.Count; i++)
                                 {
@@ -568,7 +591,7 @@
                                     }
                                     else if (status.key == FunctionAttributeKey.Url)
                                     {
-                                        //瀛樺湪url灏变竴璧峰彂閫佽繃鍘�
+                                        //瀛樺湪url灏变竴璧峰彂杩囧幓
                                         if (!string.IsNullOrEmpty(song.url))
                                         {
                                             //鎺у埗闇�瑕侊紙鐣岄潰涓嶉渶瑕佹樉绀猴級
@@ -651,43 +674,6 @@
             btnFunctionName.MouseUpEventHandler = (sender, e) =>
             {
                 LoadEditDialog_OnOff(sceneStatus, btnFunctionText);
-                //var colorfulModePage = new SetSceneRgbColorfulModePage();
-                //colorfulModePage.backAction = (selectedSerise,status) => {
-                //    if (selectedSerise == null)
-                //    {
-                //        if (status == "on")
-                //        {
-                //            isColorful = true;
-                //        }
-                //        else
-                //        {
-                //            isColorful = false;
-                //        }
-                //    }
-                //    else
-                //    {
-                //        isColorful = true;
-                //        rgbColorful = selectedSerise.ConvertSceneFunction();
-                //    }
-                //    if (isColorful)
-                //    {
-                //        btnFunctionText.TextID = StringId.On;
-                //        if (selectedSerise != null)
-                //        {
-                //            btnFunctionText.Text = selectedSerise.name;
-                //        }
-                //    }
-                //    else
-                //    {
-                //        btnFunctionText.TextID = StringId.OFF;
-                //    }
-                //    UpdataFunctionRow();
-                //};
-                //MainPage.BasePageView.AddChidren(colorfulModePage);
-                //colorfulModePage.LoadPage(sceneFunction.localFunction.sid.Substring(0,16));
-                //MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
-
-
             };
 
             #endregion

--
Gitblit v1.8.0