mac
2024-07-25 3f6685c77beeb12baf840733fb890860f4c26e7c
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs
@@ -53,12 +53,14 @@
        {
            bodyView.BackgroundColor = CSS_Color.BackgroundColor;
            new TopViewDiv(bodyView, sceneFunction.localFunction.name).LoadTopView();
            var topView = new TopViewDiv(bodyView, sceneFunction.localFunction.name);
            topView.maginY = 10;
            topView.LoadTopView();
            contentView = new VerticalScrolViewLayout()
            {
                Y = Application.GetRealHeight(64),
                Height = Application.GetRealHeight(520),
                Y = Application.GetRealHeight(64 + 10),
                Height = Application.GetRealHeight(510),
                ScrollEnabled = false,
            };
            bodyView.AddChidren(contentView);
@@ -79,13 +81,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 +195,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 +231,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,21 +241,40 @@
                {
                    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
                    {
                        scene.functions.Insert(0, sceneFunction);
                    if (sceneFunction.localFunction.spk == SPK.MusicStandard)
                    {
                        for (var i = 0; i < sceneFunction.status.Count;)
                        {
                            var ddd = sceneFunction.status[i];
                            if (string.IsNullOrEmpty(ddd.value))
                            {
                                sceneFunction.status.Remove(ddd);
                                continue;
                            }
                            i++;
                        }
                        if (sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.PlaylistName) == null)
                        {
                            if (isOnStatus)
                            {
                                var songNameStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
                                {
                                    if (songNameStatus != null)
                                    {
                                        if (string.IsNullOrEmpty(songNameStatus.value))
                                        {
                                            sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.PlaylistName, value = "hdl_special" });
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!string.IsNullOrEmpty(scene.userSceneId))
                    {
@@ -269,7 +314,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 +333,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 +609,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 +622,7 @@
                                    }
                                    else if (status.key == FunctionAttributeKey.Url)
                                    {
                                        //存在url就一起发送过去
                                        //存在url就一起发过去
                                        if (!string.IsNullOrEmpty(song.url))
                                        {
                                            //控制需要(界面不需要显示)
@@ -651,43 +705,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