From 54be52bc0ab6ce3207d421db4e5b05d14886b148 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 07 十一月 2023 16:46:53 +0800
Subject: [PATCH] UI优化
---
HDL_ON/UI/UI2/3-Intelligence/Scene/SetSceneFunctionInfoPage.cs | 245 +++++++++++++++++++++++++++++++++----------------
1 files changed, 165 insertions(+), 80 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..08820bd 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
@@ -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)
{
@@ -126,6 +128,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 +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);
+ }
}
}
}
@@ -200,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 });
}
}
}
@@ -209,16 +241,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
@@ -263,7 +285,14 @@
void UpdataFunctionRow()
{
- contentView.RemoveAll();
+ try
+ {
+ contentView.RemoveAll();
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log(ex.Message);
+ }
for (var i = 0; i < functionRowList.Count; i++)
{
try
@@ -275,37 +304,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();
+ }
}
}
}
@@ -537,6 +568,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;
+
}
};
@@ -606,43 +676,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
@@ -2396,8 +2429,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