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/SceneAddPage.cs | 399 ++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 294 insertions(+), 105 deletions(-)
diff --git a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
index 6043907..575dadd 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Scene/SceneAddPage.cs
@@ -97,14 +97,16 @@
public void LoadPage()
{
- new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene)).LoadTopView();
+ var topView = new TopViewDiv(bodyView, Language.StringByID(StringId.NewScene));
+ topView.maginY = 10;
+ topView.LoadTopView();
bodyView.BackgroundColor = CSS_Color.MainBackgroundColor;
var contentView = new VerticalScrolViewLayout()
{
- Y = Application.GetRealHeight(64),
- Height = Application.GetRealHeight(603 - 50),
+ Y = Application.GetRealHeight(64+10),
+ Height = Application.GetRealHeight(603 - 50 -10),
//BackgroundColor = CSS_Color.DividingLineColor,
};
bodyView.AddChidren(contentView);
@@ -423,25 +425,6 @@
};
row.AddChidren(btnFunctionInfo);
- var btnFunctionDelayInfo = new Button()
- {
- Width = Application.GetRealWidth(327),
- Y = Application.GetRealWidth(35),
- Height = Application.GetRealWidth(32),
- TextAlignment = TextAlignment.TopRight,
- TextColor = CSS_Color.PromptingColor1,
- TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
- };
- row.AddChidren(btnFunctionDelayInfo);
-
- if (Convert.ToInt32(scenefunction.delay) > 0)
- {
- btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText();
- }
- else
- {
- btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay);
- }
var btnFunctionName = new Button()
{
@@ -454,28 +437,74 @@
};
row.AddChidren(btnFunctionName);
- var btnFunctionFloorAndRoom = new Button()
+ if (scenefunction.type == "7")
{
- X = Application.GetRealWidth(16),
- Y = Application.GetRealWidth(24),
- Height = Application.GetRealWidth(41),
- TextAlignment = TextAlignment.CenterLeft,
- TextColor = CSS_Color.PromptingColor1,
- TextSize = CSS_FontSize.TextFontSize,
- Text = scenefunction.localFunction.GetRoomListName(),
- };
- row.AddChidren(btnFunctionFloorAndRoom);
+ btnFunctionName.Gravity = Gravity.CenterVertical;
+ btnFunctionInfo.TextAlignment = TextAlignment.CenterRight;
+ btnFunctionInfo.Gravity = Gravity.CenterVertical;
- EventHandler<MouseEventArgs> skipEvent= (sender, e) =>
+ btnFunctionName.MouseUpEventHandler = (sender, e) =>{
+ try
+ {
+ LoadAutomationSettingDialog(scenefunction, btnFunctionInfo);
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"load automation error : {ex.Message}");
+ }
+ };
+ }
+ else
{
- var ssf = new SceneFunctionInfoEditPage(scene, scenefunction.localFunction.ConvertSceneFunction(), refreshFunctionRowAction);
- MainPage.BasePageView.AddChidren(ssf);
- ssf.LoadPage();
- MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
- };
+ var btnFunctionDelayInfo = new Button()
+ {
+ Width = Application.GetRealWidth(327),
+ Y = Application.GetRealWidth(35),
+ Height = Application.GetRealWidth(32),
+ TextAlignment = TextAlignment.TopRight,
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
+ };
+ row.AddChidren(btnFunctionDelayInfo);
- btnFunctionName.MouseUpEventHandler = skipEvent;
- btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
+ if (Convert.ToInt32(scenefunction.delay) > 0)
+ {
+ btnFunctionDelayInfo.Text = Language.StringByID(StringId.Delay) + " " + new Scene() { delay = scenefunction.delay }.GetDelayText();
+ }
+ else
+ {
+ btnFunctionDelayInfo.Text = Language.StringByID(StringId.NoDelay);
+ }
+
+ var btnFunctionFloorAndRoom = new Button()
+ {
+ X = Application.GetRealWidth(16),
+ Y = Application.GetRealWidth(24),
+ Height = Application.GetRealWidth(41),
+ TextAlignment = TextAlignment.CenterLeft,
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.TextFontSize,
+ Text = scenefunction.localFunction.GetRoomListName(),
+ };
+ row.AddChidren(btnFunctionFloorAndRoom);
+ EventHandler<MouseEventArgs> skipEvent = (sender, e) =>
+ {
+ try
+ {
+ var ssf = new SceneFunctionInfoEditPage(scene, scenefunction.localFunction.ConvertSceneFunction(), refreshFunctionRowAction);
+ MainPage.BasePageView.AddChidren(ssf);
+ ssf.LoadPage();
+ MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
+ }
+ catch (Exception ex)
+ {
+ MainPage.Log($"load SceneFunctionInfoEditPage error : {ex.Message}");
+ }
+ };
+
+ btnFunctionName.MouseUpEventHandler = skipEvent;
+ btnFunctionFloorAndRoom.MouseUpEventHandler = skipEvent;
+ }
Button btnDelSceneFunction = new Button()
{
@@ -502,49 +531,112 @@
string GetFunctionScnenInfo(SceneFunction sceneFunction)
{
var sceneFunctionInfo = "";
- foreach (var sfs in sceneFunction.status)
+ if (sceneFunction.type == "7")
{
- if (sfs.key == FunctionAttributeKey.OnOff)
+ foreach (var sfs in sceneFunction.status)
{
- if (sfs.value == "off")
- return Language.StringByID(StringId.Close);
+ if (sfs.key == "enable")
+ {
+ if (sfs.value == "true")
+ return Language.StringByID(StringId.OpenArm);
+ else
+ {
+ return Language.StringByID(StringId.Close);
+ }
+ }
}
}
+ else
+ {
+ foreach (var sfs in sceneFunction.status)
+ {
+ if (sfs.key == FunctionAttributeKey.OnOff)
+ {
+ if (sfs.value == "off")
+ return Language.StringByID(StringId.Close);
+ }
+ }
- sceneFunctionInfo += Language.StringByID(StringId.Open);
+ sceneFunctionInfo += Language.StringByID(StringId.Open);
- var modeState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
- var tempState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
- var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
- if (modeState != null)
- {
- sceneFunctionInfo += modeState.GetValueText();
- }
- if (tempState != null)
- {
- sceneFunctionInfo += tempState.GetValueText();
- sceneFunctionInfo += tempState.GetUintString();
- }
- if (fanState != null)
- {
- sceneFunctionInfo += fanState.GetValueText();
- }
- var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
- if (briState != null)
- {
- sceneFunctionInfo += " " + briState.value + "%";
- }
- var perState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
- if (perState != null)
- {
- sceneFunctionInfo += " " + perState.value + "%";
- }
- var perAngle = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
- if (perAngle != null)
- {
- sceneFunctionInfo += " "+ perState.value + "掳";
- }
+ var modeState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode);
+ var tempState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp);
+ var fanState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
+ if (modeState != null)
+ {
+ sceneFunctionInfo += modeState.GetValueText();
+ }
+ if (tempState != null)
+ {
+ sceneFunctionInfo += tempState.GetValueText();
+ sceneFunctionInfo += tempState.GetUintString();
+ }
+ if (fanState != null)
+ {
+ sceneFunctionInfo += fanState.GetValueText();
+ }
+ var briState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
+ if (briState != null)
+ {
+ sceneFunctionInfo += " " + briState.value + "%";
+ }
+ var perState = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
+ if (perState != null)
+ {
+ sceneFunctionInfo += " " + perState.value + "%";
+ }
+ var perAngle = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Angle);
+ if (perAngle != null)
+ {
+ sceneFunctionInfo += " " + perAngle.value + "掳";
+ }
+ var perColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
+ if (perColorful != null)
+ {
+ if (perColorful.value == "on")
+ {
+ sceneFunctionInfo += " " + Language.StringByID(StringId.HorseRaceLamp);
+ }
+ else
+ {
+ if (sceneFunction.localFunction.spk == SPK.GroupControl)
+ {
+ sceneFunctionInfo += " " + Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp);
+ }
+ else
+ {
+ sceneFunctionInfo = Language.StringByID(StringId.Close) + " " + Language.StringByID(StringId.HorseRaceLamp);
+ }
+ }
+ }
+
+ var perSetVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetVolume);
+ if (perSetVolume != null)
+ {
+ sceneFunctionInfo += " " + perSetVolume.value;
+ }
+
+ var perSignal = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Signal);
+ if (perSignal != null)
+ {
+ var p = new HDL_ON.UI.UI2.Intelligence.Automation.PublicInterface();
+ string key = p.GetKey(p.GetHisenseSignalSourceDic(), perSignal.value);
+ sceneFunctionInfo += " " + key;
+ }
+
+ var perVolume = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Volume);
+ if (perVolume != null)
+ {
+ sceneFunctionInfo += " " + perVolume.value;
+ }
+
+ var perSongName = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SongName);
+ if (perSongName != null)
+ {
+ sceneFunctionInfo += " " + perSongName.value;
+ }
+ }
return sceneFunctionInfo;
}
@@ -636,6 +728,116 @@
}
+
+ /// <summary>
+ /// 鍔犺浇鑷姩鍖栭厤缃脊绐�
+ /// </summary>
+ void LoadAutomationSettingDialog(SceneFunction temp,Button btnTipText)
+ {
+ Dialog dialog = new Dialog();
+
+ var pView = new FrameLayout()
+ {
+ BackgroundColor = CSS_Color.DialogTransparentColor1,
+ };
+ dialog.AddChidren(pView);
+
+ var optionBaseView = new FrameLayout()
+ {
+ Y = Application.GetRealHeight(500),
+ Height = Application.GetRealHeight(160),
+ AnimateSpeed = 0.3f,
+ Animate = Animate.DownToUp,
+ };
+ pView.AddChidren(optionBaseView);
+
+ var optionView = new VerticalScrolViewLayout()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(100),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Radius = (uint)Application.GetRealWidth(12),
+ ScrollEnabled = false,
+ };
+ optionBaseView.AddChidren(optionView);
+
+ var btnOn = new Button()
+ {
+ Height = Application.GetRealHeight(50),
+ TextAlignment = TextAlignment.Center,
+ TextColor = CSS_Color.TextualColor,
+ SelectedTextColor = CSS_Color.MainColor,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextID = StringId.OpenArm,
+ };
+ optionView.AddChidren(btnOn);
+
+ optionView.AddChidren(new Button() { Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
+
+ var btnOff = new Button()
+ {
+ Height = Application.GetRealHeight(50),
+ TextAlignment = TextAlignment.Center,
+ TextColor = CSS_Color.TextualColor,
+ SelectedTextColor = CSS_Color.MainColor,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextID = StringId.Close,
+ };
+ optionView.AddChidren(btnOff);
+
+ var btnCancel = new Button()
+ {
+ Gravity = Gravity.CenterHorizontal,
+ Y = Application.GetRealHeight(8) + optionView.Bottom,
+ Width = Application.GetRealWidth(343),
+ Height = Application.GetRealHeight(50),
+ BackgroundColor = CSS_Color.MainBackgroundColor,
+ Radius = (uint)Application.GetRealWidth(12),
+ TextID = StringId.Cancel,
+ TextColor = CSS_Color.WarningColor,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ };
+ optionBaseView.AddChidren(btnCancel);
+
+ dialog.Show();
+
+ pView.MouseUpEventHandler = (sender, e) =>
+ {
+ dialog.Close();
+ };
+
+ btnCancel.MouseUpEventHandler = (sender, e) =>
+ {
+ dialog.Close();
+ };
+ btnOn.MouseUpEventHandler = (sender, e) =>
+ {
+ dialog.Close();
+ temp = new SceneFunction();
+ temp.type = "7";
+ temp.status.Add(new SceneFunctionStatus()
+ {
+ key = "enable",
+ value = "true"
+ });
+ btnTipText.TextID = StringId.OpenArm;
+ };
+ btnOff.MouseUpEventHandler = (sender, e) =>
+ {
+ dialog.Close();
+ temp = new SceneFunction();
+ temp.type = "7";
+ temp.status.Add(new SceneFunctionStatus()
+ {
+ key = "enable",
+ value = "false"
+ });
+ btnTipText.TextID = StringId.Close;
+ };
+
+ }
+
}
//--------------------------------------
public partial class SceneAddPage
@@ -676,10 +878,22 @@
void LoadEvent_ChangeFunctionList()
{
btnAddFunctionTitle.MouseUpEventHandler = (sender, e) => {
- var sefp = new SceneFunctionListChoosePage(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;
+ }
};
}
@@ -718,18 +932,6 @@
{
btnTakePicture.IsSelected = false;
- //var pid = Guid.NewGuid();
- //CropImage.TakePicture((imagePath) =>
- //{
- // if (imagePath != null)
- // {
- // addSceneImageView.ImagePath = imagePath.ToString();
- // scene.ImagePath = addSceneImageView.ImagePath;
- // MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath);
- // }
- //}, pid.ToString(), 4, 3);
-
-
var imageName = Guid.NewGuid().ToString();
//var imageName = scene.sid;
CropImage.TakePicture((imagePath) =>
@@ -738,9 +940,6 @@
}, imageName, 4, 3);
- //if (pageTitleId == StringId.EditScene)
- //{
- // scene.SaveFunctionData();
//}
pictureOptionView.Parent.RemoveFromParent();
};
@@ -751,16 +950,6 @@
btnAlbum.MouseUpEventHandler = (sender, e) =>
{
btnAlbum.IsSelected = false;
- //var pid = Guid.NewGuid();
- //CropImage.SelectPicture((imagePath) =>
- //{
- // if (imagePath != null)
- // {
- // addSceneImageView.ImagePath = imagePath.ToString();
- // scene.ImagePath = addSceneImageView.ImagePath;
- // MainPage.Log("SelectPicture 瑁佸壀鍥剧墖杩斿洖璺緞: " + imagePath);
- // }
- //}, pid.ToString(), 4, 3);
//浠庣浉鍐岄�夋嫨鍥剧墖瑁佸壀
var imageName = Guid.NewGuid().ToString();
--
Gitblit v1.8.0