From 5ec581e5d37b108fc9d59e89afd8e94e21b32080 Mon Sep 17 00:00:00 2001 From: mac <user@users-MacBook-Pro.local> Date: 星期二, 17 十月 2023 17:33:36 +0800 Subject: [PATCH] 2023年10月17日17:33:33 --- HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 146 ++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 133 insertions(+), 13 deletions(-) diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs index 681f9a9..440e8f2 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs @@ -29,10 +29,10 @@ public SceneFunctionInfoEditPage(Scene s, SceneFunction fc, Action action) { - + 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) { @@ -126,6 +126,12 @@ break; case FunctionAttributeKey.Signal: LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal)); + break; + case FunctionAttributeKey.SongName: + LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName)); + break; + case FunctionAttributeKey.Volume: + LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume)); break; } } @@ -187,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); + } } } } @@ -537,6 +566,45 @@ sceneStatus.value = p.GetValue(dic, valueStr); }); break; + case FunctionAttributeKey.Volume: + BrightnessView(btnFunctionText.Text, btnFunctionName.Text, (volume, uintStr) => + { + btnFunctionText.Text = volume; + sceneStatus.value = volume; + }); + break; + case FunctionAttributeKey.SongName: + MusicListView(btnFunctionText.Text, (playListName, song) => + { + btnFunctionText.Text = song.name; + sceneStatus.value = song.name; + //杩藉姞灞炴�� + var oldList = new List<SceneFunctionStatus>(); + for (int i = 0; i < sceneFunction.status.Count; i++) + { + var status = sceneFunction.status[i]; + if (status.key == FunctionAttributeKey.PlaylistName) + { + //鎺у埗闇�瑕侊紙鐣岄潰涓嶉渶瑕佹樉绀猴級 + sceneFunction.status.RemoveAt(i); + sceneFunction.status.Insert(i, new SceneFunctionStatus { key = FunctionAttributeKey.PlaylistName, value = playListName }); + } + else if (status.key == FunctionAttributeKey.Url) + { + //瀛樺湪url灏变竴璧峰彂杩囧幓 + if (!string.IsNullOrEmpty(song.url)) + { + //鎺у埗闇�瑕侊紙鐣岄潰涓嶉渶瑕佹樉绀猴級 + sceneFunction.status.RemoveAt(i); + sceneFunction.status.Insert(i, new SceneFunctionStatus { key = FunctionAttributeKey.Url, value = song.url }); + } + } + + } + + }); + break; + } }; @@ -2396,8 +2464,60 @@ pif.SingleSelectionShow(this, list, titleName, oldStateValue, action); } - #endregion + /// <summary> + /// 闊充箰鍒楄〃鐣岄潰 + /// </summary> + /// <param name="oldStateValue">鏃х姸鎬佸��</param> + /// <param name="action">鍥炶皟</param> + void MusicListView(string oldStateValue, Action<string, Music.SongInfo> action) + { + Loading loading = new Loading(); + this.AddChidren(loading); + loading.Start(); + System.Threading.Tasks.Task.Run(() => + { + try + { + var palyList = Music.SendMethod.Current.GetSingleSongList(new Function { sid = sceneFunction.sid }, "hdl_special", ""); + List<string> songNameList = new List<string>(); + for (int i = 0; i < palyList.songs.Count; i++) + { + var song = palyList.songs[i]; + songNameList.Add(song.name); + } + Application.RunOnMainThread(() => + { + loading.Hide(); + var publicInterface = new UI2.Intelligence.Automation.PublicInterface(); + publicInterface.FrameOrVv(this, songNameList, new List<string> { oldStateValue }, palyList.group, (index) => + { + if (index > palyList.songs.Count) + { + index = 0; + } + var song = palyList.songs[index]; + action?.Invoke(palyList.group, song); + //鐣岄潰鏄剧ず閫変腑鍊� + //funTypeView.btnState.Text = songSelecetd.name; + ////鏁版嵁灏佽 + //AddDictionary("playlist_name", palyList.group);//鍒楄〃鍚� + //AddDictionary("song_name", songSelecetd.name);//姝屾洸鍚� + //if (!string.IsNullOrEmpty(songSelecetd.url)) + //{ + // //瀛樺湪url灏变竴璧峰彂閫佽繃鍘� + // AddDictionary("url", songSelecetd.url); + //} + + }, false); + + }); + } + catch { } + + }); + } + #endregion } } -- Gitblit v1.8.0