//using System;
|
//using HDL_ON.Entity;
|
//using HDL_ON.UI.CSS;
|
//using Shared;
|
//using System.Collections.Generic;
|
|
//namespace HDL_ON.UI
|
//{
|
// public class SceneFunctionInfoEditPage : FrameLayout
|
// {
|
// FrameLayout bodyView;
|
// VerticalScrolViewLayout contentView;
|
// Button btnOnText;
|
// Button btnBrightnessText;
|
|
// Scene scene;
|
|
// Action refreshAction;
|
// SceneFunction sceneFunction;
|
|
// bool isColorful = false;
|
|
// public SceneFunctionInfoEditPage(Scene s, SceneFunction fc,Action action)
|
// {
|
// bodyView = this;
|
// scene = s;
|
// sceneFunction = fc.localFunction.ConvertSceneFunction();
|
// foreach(var ll in sceneFunction.status)
|
// {
|
// try
|
// {
|
// var temp = fc.status.Find((obj) => obj.key == ll.key);
|
// if (temp != null)
|
// ll.value = temp.value;
|
// }
|
// catch { }
|
// }
|
// refreshAction = action;
|
// }
|
|
// public void LoadPage()
|
// {
|
// bodyView.BackgroundColor = CSS_Color.BackgroundColor;
|
|
// new TopViewDiv(bodyView, sceneFunction.localFunction.name).LoadTopView();
|
|
// contentView = new VerticalScrolViewLayout()
|
// {
|
// Y = Application.GetRealHeight(64),
|
// Height = Application.GetRealHeight(520),
|
// ScrollEnabled = false,
|
// };
|
// bodyView.AddChidren(contentView);
|
|
// var onOffStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff);
|
|
// LoadFunctionRow(onOffStatus);
|
|
// if (sceneFunction.localFunction.spk == SPK.LightRGB)
|
// {
|
// var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
|
// if (colorfulStatus != null)
|
// {
|
// isColorful = true;
|
// LoadColorfulRow(colorfulStatus);
|
// }
|
// }
|
// if(!isColorful)
|
// {
|
// foreach (var attr in sceneFunction.status)
|
// {
|
// switch (attr.key)
|
// {
|
// case FunctionAttributeKey.SetTemp:
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp));
|
// break;
|
// case FunctionAttributeKey.Mode:
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode));
|
// break;
|
// case FunctionAttributeKey.FanSpeed:
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed));
|
// break;
|
// case FunctionAttributeKey.Percent:
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent));
|
// break;
|
// case FunctionAttributeKey.Brightness:
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness));
|
// break;
|
// case FunctionAttributeKey.FadeTime:
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FadeTime));
|
// break;
|
// case FunctionAttributeKey.CCT:
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.CCT));
|
// break;
|
// case FunctionAttributeKey.RGB:
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.RGB));
|
// break;
|
// case "angle"://角度
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == "angle"));
|
// break;
|
// case "security"://大华摄像布防撤防
|
// LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == "security"));
|
// break;
|
// }
|
// }
|
|
// if (DB_ResidenceData.Instance.GatewayType != 0)
|
// {
|
// //加载延时Row
|
// LoadDelayRow();
|
// }
|
// }
|
// var bottomView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(591),
|
// Height = Application.GetRealHeight(106),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(16),
|
// };
|
// bodyView.AddChidren(bottomView);
|
|
// var btnConfrim = new Button()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// Y = Application.GetRealHeight(12),
|
// Width = Application.GetRealWidth(220),
|
// Height = Application.GetRealWidth(44),
|
// TextAlignment = TextAlignment.Center,
|
// TextColor = CSS_Color.MainBackgroundColor,
|
// BackgroundColor = CSS_Color.MainColor,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// IsBold = true,
|
// Radius = (uint) Application.GetRealWidth(22),
|
// TextID = StringId.Complete
|
// };
|
// bottomView.AddChidren(btnConfrim);
|
|
// btnConfrim.MouseUpEventHandler = (sender, e) =>
|
// {
|
// var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid);
|
|
// 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;
|
// }
|
// }
|
// }
|
// else
|
// {
|
// scene.functions.Add(sceneFunction);
|
// }
|
// if (!string.IsNullOrEmpty(scene.userSceneId))
|
// {
|
// var result = scene.UpdateScene();
|
// if (result == DAL.Server.StateCode.SUCCESS)
|
// {
|
// refreshAction();
|
// this.RemoveFromParent();
|
// }
|
// else
|
// {
|
// DAL.Server.IMessageCommon.Current.ShowErrorInfoAlter(result);
|
// }
|
// }
|
// else
|
// {
|
// refreshAction();
|
// this.RemoveFromParent();
|
// }
|
// };
|
// }
|
|
|
// /// <summary>
|
// /// 加载功能Row
|
// /// </summary>
|
// void LoadFunctionRow(SceneFunctionStatus sceneStatus)
|
// {
|
// if (sceneStatus == null)
|
// return;
|
// #region Row code
|
// var row = new FrameLayout()
|
// {
|
// Height = Application.GetRealHeight(50),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// };
|
// contentView.AddChidren(row);
|
|
|
// if (sceneStatus.key != FunctionAttributeKey.OnOff)
|
// {
|
// row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
// }
|
// else
|
// {
|
// if(sceneStatus.value == "stop")
|
// {
|
// sceneStatus.value = "on";
|
// }
|
// }
|
// Button btnRight = new Button()
|
// {
|
// X = Application.GetRealWidth(339),
|
// Gravity = Gravity.CenterVertical,
|
// Width = Application.GetMinRealAverage(16),
|
// Height = Application.GetMinRealAverage(16),
|
// UnSelectedImagePath = "Public/Right.png",
|
// };
|
// row.AddChidren(btnRight);
|
|
|
// var showCode = "";
|
|
// if (sceneStatus.key == FunctionAttributeKey.Mode)
|
// {
|
// if (DB_ResidenceData.Instance.GatewayType == 0)
|
// {
|
// if (SPK.AcSpkList().Contains(sceneFunction.localFunction.spk))
|
// {
|
// //0 制冷1制热,2通风,3自动,4除湿
|
// switch (sceneStatus.value)
|
// {
|
// case "0":
|
// showCode = "cool";
|
// break;
|
// case "1":
|
// showCode = "heat";
|
// break;
|
// case "2":
|
// showCode = "fan";
|
// break;
|
// case "3":
|
// showCode = "auto";
|
// break;
|
// case "4":
|
// showCode = "dry";
|
// break;
|
// }
|
// }
|
// else if (SPK.FhSpkList().Contains(sceneFunction.localFunction.spk))
|
// {
|
// //1:普通,2:白天,3:夜晚,4:离开,5:时间
|
// switch (sceneStatus.value)
|
// {
|
// case "5":
|
// showCode = "timer";
|
// break;
|
// case "1":
|
// showCode = "normal";
|
// break;
|
// case "2":
|
// showCode = "day";
|
// break;
|
// case "3":
|
// showCode = "night";
|
// break;
|
// case "4":
|
// showCode = "away";
|
// break;
|
// }
|
// }
|
// }
|
// }
|
|
// var btnFunctionText = new Button()
|
// {
|
// Width = Application.GetRealWidth(330),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
// Text = sceneStatus.GetValueText(showCode) + sceneStatus.GetUintString()
|
// };
|
// row.AddChidren(btnFunctionText);
|
// if (sceneStatus.key == FunctionAttributeKey.RGB)
|
// {
|
// btnFunctionText.Width = Application.GetRealWidth(28);
|
// btnFunctionText.Height = Application.GetRealWidth(28);
|
// btnFunctionText.X = Application.GetRealWidth(330 - 28);
|
// btnFunctionText.Gravity = Gravity.CenterVertical;
|
// btnFunctionText.Radius = (uint)Application.GetRealWidth(8);
|
// btnFunctionText.Text = "";
|
// btnFunctionText.BackgroundColor = (uint)(0xFF000000 + new Light().GetRGBcolor(sceneStatus.value));
|
// }
|
|
|
|
// if (sceneStatus.key == FunctionAttributeKey.OnOff)
|
// {
|
// btnOnText = btnFunctionText;
|
// }
|
// else if (sceneStatus.key == FunctionAttributeKey.Brightness || sceneStatus.key == FunctionAttributeKey.Percent)
|
// {
|
// int outT = 0;
|
// int.TryParse(sceneStatus.value, out outT);
|
// if (outT < 0)
|
// sceneStatus.value = "0";
|
// btnBrightnessText = btnFunctionText;
|
// }
|
|
// var btnFunctionName = new Button()
|
// {
|
// X = Application.GetRealWidth(16),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.FirstLevelTitleColor,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// Text = sceneStatus.GetNameText()
|
// };
|
// row.AddChidren(btnFunctionName);
|
// btnFunctionName.MouseUpEventHandler = (sender, e) =>
|
// {
|
// switch (sceneStatus.key)
|
// {
|
// case FunctionAttributeKey.Security:
|
// LoadEditDialog_Security(sceneStatus, btnFunctionText);
|
// break;
|
// case FunctionAttributeKey.OnOff:
|
// LoadEditDialog_OnOff(sceneStatus, btnFunctionText);
|
// break;
|
// case FunctionAttributeKey.Brightness:
|
// LoadEditDialog_Percent(sceneStatus, btnFunctionText);
|
// break;
|
// case FunctionAttributeKey.Mode:
|
// var statusList = new List<string>();
|
// var tr = sceneFunction.localFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.Mode);
|
// foreach(var t in tr.value)
|
// {
|
// statusList.Add(t);
|
// }
|
// LoadEditDialog_FunctionPar(sceneStatus, btnFunctionText,statusList);
|
// break;
|
// case FunctionAttributeKey.FanSpeed:
|
// var fanStatusList = new List<string>();
|
// var tr1 = sceneFunction.localFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
|
// foreach (var t in tr1.value)
|
// {
|
// fanStatusList.Add(t);
|
// }
|
// LoadEditDialog_FunctionPar(sceneStatus, btnFunctionText, fanStatusList);
|
// break;
|
// case FunctionAttributeKey.SetTemp:
|
// LoadEditDialog_Temp(sceneStatus, btnFunctionText);
|
// break;
|
// case FunctionAttributeKey.FadeTime:
|
|
// break;
|
// case "angle":
|
// //呈现的弹窗
|
// LoadEditDialog_Angle(sceneStatus, btnFunctionText);
|
|
// break;
|
// case "cct":
|
// LoadEditDialog_CCT(sceneStatus, btnFunctionText);
|
// break;
|
// case FunctionAttributeKey.RGB:
|
// btnFunctionText.Width = Application.GetRealWidth(28);
|
// btnFunctionText.Height = Application.GetRealWidth(28);
|
// btnFunctionText.X = Application.GetRealWidth(330 - 28);
|
// btnFunctionText.Gravity = Gravity.CenterVertical;
|
// btnFunctionText.Radius = (uint)Application.GetRealWidth(8);
|
// btnFunctionText.Text = "";
|
|
// LoadEditDialog_RGB(sceneStatus, btnFunctionText);
|
// break;
|
// case FunctionAttributeKey.Percent:
|
// LoadEditDialog_Percent(sceneStatus, btnFunctionText);
|
// break;
|
// }
|
// };
|
|
// #endregion
|
// }
|
|
// /// <summary>
|
// /// 加载功能Row
|
// /// </summary>
|
// void LoadColorfulRow(SceneFunctionStatus sceneStatus)
|
// {
|
// if (sceneStatus == null)
|
// return;
|
// #region Row code
|
// var row = new FrameLayout()
|
// {
|
// Height = Application.GetRealHeight(50),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// };
|
// contentView.AddChidren(row);
|
|
// row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
|
// Button btnRight = new Button()
|
// {
|
// X = Application.GetRealWidth(339),
|
// Gravity = Gravity.CenterVertical,
|
// Width = Application.GetMinRealAverage(16),
|
// Height = Application.GetMinRealAverage(16),
|
// UnSelectedImagePath = "Public/Right.png",
|
// };
|
// row.AddChidren(btnRight);
|
|
|
// var showCode = "";
|
|
// var btnFunctionText = new Button()
|
// {
|
// Width = Application.GetRealWidth(330),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
// Text = sceneStatus.GetValueText(showCode)
|
// };
|
// row.AddChidren(btnFunctionText);
|
|
// var btnFunctionName = new Button()
|
// {
|
// X = Application.GetRealWidth(16),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.FirstLevelTitleColor,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// TextID = StringId.ColorfulFunction
|
// };
|
// row.AddChidren(btnFunctionName);
|
// btnFunctionName.MouseUpEventHandler = (sender, e) =>
|
// {
|
// LoadEditDialog_OnOff(sceneStatus, btnFunctionText);
|
// };
|
|
// #endregion
|
// }
|
|
|
|
// #region 加载功能场景数据调节界面
|
// /// <summary>
|
// /// 加载延时Row
|
// /// </summary>
|
// void LoadDelayRow()
|
// {
|
// #region 延时row
|
// FrameLayout delayRow = new FrameLayout()
|
// {
|
// Height = Application.GetRealWidth(50),
|
// BackgroundColor = CSS_Color.MainBackgroundColor
|
// };
|
// contentView.AddChidren(delayRow);
|
// delayRow.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
|
// Button btnDelayRight = new Button()
|
// {
|
// X = Application.GetRealWidth(339),
|
// Gravity = Gravity.CenterVertical,
|
// Width = Application.GetMinRealAverage(16),
|
// Height = Application.GetMinRealAverage(16),
|
// UnSelectedImagePath = "Public/Right.png",
|
// };
|
// delayRow.AddChidren(btnDelayRight);
|
|
// var btnDelayInfo = new Button()
|
// {
|
// Width = Application.GetRealWidth(327),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
// Text = new Scene() { delay = sceneFunction.delay }.GetDelayText()
|
// };
|
// delayRow.AddChidren(btnDelayInfo);
|
|
// Button btnSceneDelayTitle = new Button()
|
// {
|
// X = Application.GetRealWidth(16),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.FirstLevelTitleColor,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// TextID = StringId.Delay,
|
// };
|
// delayRow.AddChidren(btnSceneDelayTitle);
|
|
|
// btnSceneDelayTitle.MouseUpEventHandler = (sender, e) => {
|
// Action<string> action = (obj) => {
|
// sceneFunction.delay = obj;
|
// btnDelayInfo.Text = new Scene() { delay = sceneFunction.delay }.GetDelayText();
|
// };
|
// Dictionary<string, string> items = new Dictionary<string, string>();
|
// items.Add("30", "30s");
|
// items.Add("60", "1min");
|
// items.Add("120", "2min");
|
// items.Add("300", "5min");
|
// new PublicAssmebly().SetSceneDelayDialog(action, sceneFunction.delay);
|
// };
|
// #endregion
|
|
|
// }
|
|
// #endregion
|
|
// #region 属性选择弹窗
|
// /// <summary>
|
// /// 加载开关选择弹窗
|
// /// </summary>
|
// /// <param name="function"></param>
|
// /// <param name="btn"></param>
|
// void LoadEditDialog_OnOff(SceneFunctionStatus trait, Button btn)
|
// {
|
// 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.On,
|
// IsSelected = trait.value.ToString() == "on"
|
// };
|
// 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.OFF,
|
// IsSelected = trait.value.ToString() == "off"
|
// };
|
// 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();
|
// trait.value = "on";
|
// sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "on";
|
// btn.Text = trait.GetValueText() + trait.GetUintString();
|
|
// var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
|
// if (temp == null)
|
// {
|
// temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
|
// }
|
// if (temp != null)
|
// {
|
// if (temp.value == "0")
|
// {
|
// temp.value = "100";
|
// }
|
// btnBrightnessText.Text = temp.GetValueText() + "%";
|
// }
|
// };
|
// btnOff.MouseUpEventHandler = (sender,e) =>{
|
// dialog.Close();
|
// trait.value = "off";
|
// sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = "off";
|
// btn.Text= trait.GetValueText() + trait.GetUintString();
|
|
// var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
|
// if(temp == null)
|
// {
|
// temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
|
// }
|
// if (temp != null)
|
// {
|
// if (temp.value != "0")
|
// {
|
// temp.value = "0";
|
// }
|
// btnBrightnessText.Text = temp.GetValueText() + "%";
|
// }
|
// };
|
|
// }
|
|
|
// /// <summary>
|
// /// 加载安防布防选择弹窗
|
// /// </summary>
|
// /// <param name="function"></param>
|
// /// <param name="btn"></param>
|
// void LoadEditDialog_Security(SceneFunctionStatus trait, Button btn)
|
// {
|
// 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.Defense,
|
// IsSelected = trait.value.ToString() == "true"
|
// };
|
// 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.Undefense,
|
// IsSelected = trait.value.ToString() == "false"
|
// };
|
// 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();
|
// trait.value = "true";
|
// sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "true";
|
// btn.Text = trait.GetValueText() + trait.GetUintString();
|
|
// };
|
// btnOff.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// trait.value = "false";
|
// sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "false";
|
// btn.Text = trait.GetValueText() + trait.GetUintString();
|
|
// };
|
|
// }
|
|
|
// /// <summary>
|
// /// 加载温度选择弹窗
|
// /// </summary>
|
// /// <param name="function"></param>
|
// /// <param name="btn"></param>
|
// void LoadEditDialog_Temp(SceneFunctionStatus trait, Button btn)
|
// {
|
// double temp = trait.min;
|
// double.TryParse(trait.value, out temp);
|
// trait.value = temp.ToString();
|
|
// List<string> pickerItems = new List<string>();
|
// if(trait == null)
|
// {
|
// return;
|
// }
|
|
// Dialog dialog = new Dialog();
|
|
// var pView = new FrameLayout()
|
// {
|
// BackgroundColor = CSS_Color.DialogTransparentColor1,
|
// };
|
// dialog.AddChidren(pView);
|
|
// var optionBaseView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(456-60),
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(260),
|
// AnimateSpeed = 0.3f,
|
// Animate = Animate.DownToUp,
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// pView.AddChidren(optionBaseView);
|
|
// var topView = new FrameLayout()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(40),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// optionBaseView.AddChidren(topView);
|
// topView.AddChidren(new Button() {Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
// var btnCancel = new Button()
|
// {
|
// X = Application.GetRealWidth(21),
|
// Width = Application.GetRealWidth(100),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Cancel,
|
// };
|
// topView.AddChidren(btnCancel);
|
|
// var btnConfrim = new Button()
|
// {
|
// X = Application.GetRealWidth(160),
|
// Width = Application.GetRealWidth(160),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.MainColor,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Confirm,
|
// };
|
// topView.AddChidren(btnConfrim);
|
|
// UIPickerView uIPickerView = new UIPickerView()
|
// {
|
// Y = Application.GetRealHeight(40),
|
// Height = Application.GetRealHeight(210),
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// for (int i = trait.min; i <= trait.max; i += 1)
|
// {
|
// pickerItems.Add(i.ToString() + trait.GetUintString());
|
// }
|
// uIPickerView.setNPicker(pickerItems, null, null);
|
// optionBaseView.AddChidren(uIPickerView);
|
// uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
|
|
// string selectItem = pickerItems[0];
|
// if (pickerItems.Contains(trait.value + trait.GetUintString()))
|
// {
|
// selectItem = trait.value.ToString() + trait.GetUintString();
|
// }
|
|
// dialog.Show();
|
|
// pView.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
|
// btnCancel.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
// uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
|
// selectItem = pickerItems[int1];
|
// };
|
// btnConfrim.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// btn.Text = selectItem;
|
// //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
|
// trait.value = selectItem.Replace(trait.GetUintString(),"");
|
// };
|
|
// }
|
|
// /// <summary>
|
// /// 加载温度选择弹窗
|
// /// </summary>
|
// /// <param name="function"></param>
|
// /// <param name="btn"></param>
|
// void LoadEditDialog_Angle (SceneFunctionStatus trait, Button btn)
|
// {
|
// double temp = trait.min;
|
// double.TryParse(trait.value, out temp);
|
// trait.value = temp.ToString();
|
|
// List<string> pickerItems = new List<string>();
|
// if (trait == null)
|
// {
|
// return;
|
// }
|
|
// Dialog dialog = new Dialog();
|
|
// var pView = new FrameLayout()
|
// {
|
// BackgroundColor = CSS_Color.DialogTransparentColor1,
|
// };
|
// dialog.AddChidren(pView);
|
|
// var optionBaseView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(456 - 60),
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(260),
|
// AnimateSpeed = 0.3f,
|
// Animate = Animate.DownToUp,
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// pView.AddChidren(optionBaseView);
|
|
// var topView = new FrameLayout()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(40),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// optionBaseView.AddChidren(topView);
|
// topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
// var btnCancel = new Button()
|
// {
|
// X = Application.GetRealWidth(21),
|
// Width = Application.GetRealWidth(100),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Cancel,
|
// };
|
// topView.AddChidren(btnCancel);
|
|
|
// var btnConfrim = new Button()
|
// {
|
// X = Application.GetRealWidth(160),
|
// Width = Application.GetRealWidth(160),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.MainColor,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Confirm,
|
// };
|
// topView.AddChidren(btnConfrim);
|
|
// UIPickerView uIPickerView = new UIPickerView()
|
// {
|
// Y = Application.GetRealHeight(40),
|
// Height = Application.GetRealHeight(210),
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// for (int i = trait.min; i <= trait.max; i += 1)
|
// {
|
// pickerItems.Add(i.ToString() + trait.GetUintString());
|
// }
|
// uIPickerView.setNPicker(pickerItems, null, null);
|
// optionBaseView.AddChidren(uIPickerView);
|
// uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()+ "°"), 0, 0);
|
|
// string selectItem = pickerItems[pickerItems.IndexOf(trait.value.ToString() + "°")];
|
// if (pickerItems.Contains(trait.value + trait.GetUintString()))
|
// {
|
// selectItem = trait.value.ToString() + trait.GetUintString();
|
// }
|
// //uIPickerView.setCurrentItems
|
// dialog.Show();
|
|
// pView.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
|
// btnCancel.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
// uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
|
// selectItem = pickerItems[int1];
|
// };
|
// btnConfrim.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// btn.Text = selectItem;
|
// //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
|
// trait.value = selectItem.Replace(trait.GetUintString(), "");
|
// };
|
|
// }
|
|
|
// /// <summary>
|
// /// 加载亮度选择弹窗
|
// /// </summary>
|
// /// <param name="function"></param>
|
// /// <param name="btn"></param>
|
// void LoadEditDialog_Percent(SceneFunctionStatus trait, Button btn)
|
// {
|
// if (trait == null)
|
// {
|
// return;
|
// }
|
|
// Dialog dialog = new Dialog();
|
|
// var pView = new FrameLayout()
|
// {
|
// BackgroundColor = CSS_Color.DialogTransparentColor1,
|
// };
|
// dialog.AddChidren(pView);
|
|
// var optionBaseView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(467),
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(180),
|
// AnimateSpeed = 0.3f,
|
// Animate = Animate.DownToUp,
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// pView.AddChidren(optionBaseView);
|
|
// var topView = new FrameLayout()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(40),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// optionBaseView.AddChidren(topView);
|
// topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
// var btnTitle = new Button()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// TextAlignment = TextAlignment.Center,
|
// Width = Application.GetRealWidth(100),
|
// Text = trait.GetNameText(),
|
// IsBold = true,
|
// TextColor = CSS_Color.FirstLevelTitleColor,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// };
|
// topView.AddChidren(btnTitle);
|
|
// var btnCancel = new Button()
|
// {
|
// X = Application.GetRealWidth(21),
|
// Width = Application.GetRealWidth(100),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Cancel,
|
// };
|
// topView.AddChidren(btnCancel);
|
|
// var btnConfrim = new Button()
|
// {
|
// X = Application.GetRealWidth(200),
|
// Width = Application.GetRealWidth(120),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.MainColor,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Confirm,
|
// };
|
// topView.AddChidren(btnConfrim);
|
|
// Button btnMinusSignIcon = new Button()
|
// {
|
// X = Application.GetRealWidth(26),
|
// Y = Application.GetRealHeight(118),
|
// Width = Application.GetMinRealAverage(24),
|
// Height = Application.GetMinRealAverage(24),
|
// UnSelectedImagePath = "Public/MinusSignIcon.png",
|
// };
|
// optionBaseView.AddChidren(btnMinusSignIcon);
|
|
// DiyImageSeekBar controlBar = new DiyImageSeekBar()
|
// {
|
// X = btnMinusSignIcon.Right + Application.GetRealWidth(12),
|
// Y = Application.GetRealHeight(100),//414,设计数据
|
// Width = Application.GetRealWidth(220),
|
// Height = Application.GetRealHeight(54),
|
// SeekBarViewHeight = Application.GetRealHeight(8),
|
// ThumbImagePath = "Public/ThumbImage.png",
|
// ThumbImageHeight = Application.GetRealHeight(54),
|
// ProgressBarColor = CSS_Color.MainColor,
|
// ProgressTextColor = CSS_Color.FirstLevelTitleColor,
|
// ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
// MaxValue = 100,
|
// Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32(trait.value.Replace("{}", "")),
|
// SeekBarPadding = Application.GetRealWidth(20),
|
// };
|
// optionBaseView.AddChidren(controlBar);
|
|
// Button btnPlusSgnIcon = new Button()
|
// {
|
// X = controlBar.Right + Application.GetRealWidth(12),
|
// Y = Application.GetRealHeight(118),
|
// Width = Application.GetMinRealAverage(24),
|
// Height = Application.GetMinRealAverage(24),
|
// UnSelectedImagePath = "Public/PlusSignIcon.png",
|
// };
|
// optionBaseView.AddChidren(btnPlusSgnIcon);
|
|
// btnMinusSignIcon.MouseUpEventHandler = (sender, e) =>
|
// {
|
// controlBar.Progress--;
|
// };
|
// btnPlusSgnIcon.MouseUpEventHandler = (sender, e) =>
|
// {
|
// controlBar.Progress++;
|
// };
|
|
// dialog.Show();
|
// pView.MouseUpEventHandler = (sender, e) =>
|
// {
|
// dialog.Close();
|
// };
|
|
// btnCancel.MouseUpEventHandler = (sender, e) =>
|
// {
|
// dialog.Close();
|
// };
|
// btnConfrim.MouseUpEventHandler = (sender, e) =>
|
// {
|
// dialog.Close();
|
// trait.value = controlBar.Progress.ToString();
|
// btn.Text = trait.value + trait.GetUintString();
|
|
// var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff);
|
// if (temp != null)
|
// {
|
// if (controlBar.Progress > 0)
|
// {
|
// temp.value = "on";
|
// }
|
// else
|
// {
|
// temp.value = "off";
|
// }
|
// btnOnText.Text = temp.GetValueText();
|
// }
|
// };
|
// }
|
|
|
// /// <summary>
|
// /// 加载cct选择弹窗
|
// /// </summary>
|
// /// <param name="function"></param>
|
// /// <param name="btn"></param>
|
// void LoadEditDialog_CCT(SceneFunctionStatus trait, Button btn)
|
// {
|
// double temp = trait.min;
|
// double.TryParse(trait.value, out temp);
|
// trait.value = temp.ToString();
|
|
// List<string> pickerItems = new List<string>();
|
// if (trait == null)
|
// {
|
// return;
|
// }
|
|
// Dialog dialog = new Dialog();
|
|
// var pView = new FrameLayout()
|
// {
|
// BackgroundColor = CSS_Color.DialogTransparentColor1,
|
// };
|
// dialog.AddChidren(pView);
|
|
// var optionBaseView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(456 - 60),
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(260),
|
// AnimateSpeed = 0.3f,
|
// Animate = Animate.DownToUp,
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// pView.AddChidren(optionBaseView);
|
|
// var topView = new FrameLayout()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(40),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// optionBaseView.AddChidren(topView);
|
// topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
// var btnCancel = new Button()
|
// {
|
// X = Application.GetRealWidth(21),
|
// Width = Application.GetRealWidth(100),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Cancel,
|
// };
|
// topView.AddChidren(btnCancel);
|
|
// var btnConfrim = new Button()
|
// {
|
// X = Application.GetRealWidth(200),
|
// Width = Application.GetRealWidth(120),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.MainColor,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Confirm,
|
// };
|
// topView.AddChidren(btnConfrim);
|
|
// UIPickerView uIPickerView = new UIPickerView()
|
// {
|
// Y = Application.GetRealHeight(40),
|
// Height = Application.GetRealHeight(210),
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// for (int i = trait.min; i <= trait.max; i += 100)
|
// {
|
// pickerItems.Add(i.ToString() + trait.GetUintString());
|
// }
|
// uIPickerView.setNPicker(pickerItems, null, null);
|
// optionBaseView.AddChidren(uIPickerView);
|
// uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
|
|
// string selectItem = pickerItems[0];
|
// if (pickerItems.Contains(trait.value + trait.GetUintString()))
|
// {
|
// selectItem = trait.value.ToString() + trait.GetUintString();
|
// }
|
|
// dialog.Show();
|
|
// pView.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
|
// btnCancel.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
// uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
|
// selectItem = pickerItems[int1];
|
// };
|
// btnConfrim.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// btn.Text = selectItem;
|
// //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
|
// trait.value = selectItem.Replace(trait.GetUintString(), "");
|
// };
|
|
// }
|
|
|
// /// <summary>
|
// /// 加载rgb选择弹窗
|
// /// </summary>
|
// /// <param name="function"></param>
|
// /// <param name="btn"></param>
|
// void LoadEditDialog_RGB(SceneFunctionStatus trait, Button btn)
|
// {
|
// string rgbString = trait.value;
|
|
// Light tempLight = new Light();
|
|
// if (trait == null)
|
// {
|
// return;
|
// }
|
|
// Dialog dialog = new Dialog();
|
|
// var bodyView = new FrameLayout();
|
// dialog.AddChidren(bodyView);
|
|
// var contentView = new FrameLayout()
|
// {
|
// Gravity = Gravity.Center,
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(52 + 44 + 18 + 22 + 248),
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// bodyView.AddChidren(contentView);
|
|
// #region 标题区
|
// var titleView = new FrameLayout()
|
// {
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(52),
|
// };
|
// contentView.AddChidren(titleView);
|
|
// var btnTitle = new Button()
|
// {
|
// Height = Application.GetRealHeight(52),
|
// Gravity = Gravity.Center,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// TextColor = CSS_Color.MainColor,
|
// TextID = StringId.ColorValue,
|
// TextAlignment = TextAlignment.Center,
|
// };
|
// titleView.AddChidren(btnTitle);
|
// titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) });
|
|
// #endregion
|
|
// int attrViewHight = Application.GetRealHeight(18 + 22+ 248);
|
// //属性设置区域
|
// var attrView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(52),
|
// Width = Application.GetRealWidth(343),
|
// Height = attrViewHight
|
// };
|
// contentView.AddChidren(attrView);
|
// attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
|
|
|
|
// #region RGB
|
// var rgbView = new FrameLayout()
|
// {
|
// Height = Application.GetRealHeight(248)
|
// };
|
// attrView.AddChidren(rgbView);
|
|
|
// var btnCurColor = new Button()
|
// {
|
// X = Application.GetRealWidth(24),
|
// Y = Application.GetRealHeight(10),
|
// Width = Application.GetMinRealAverage(24),
|
// Height = Application.GetMinRealAverage(24),
|
// Radius = (uint)Application.GetMinRealAverage(8),
|
// BorderColor = CSS_Color.PromptingColor2,
|
// BorderWidth = 1,
|
// BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(trait.value))
|
// };
|
// rgbView.AddChidren(btnCurColor);
|
|
// //色盘的桌布控件(限制那个白色滑动球使用)
|
// var framePickerBack = new FrameLayout();
|
// framePickerBack.Gravity = Gravity.CenterHorizontal;
|
// framePickerBack.Y = Application.GetRealHeight(20);
|
// framePickerBack.Width = Application.GetMinRealAverage(198);
|
// framePickerBack.Height = Application.GetMinRealAverage(198);
|
// rgbView.AddChidren(framePickerBack);
|
|
// var colorPicker = new ColorPicker()
|
// {
|
// ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
|
// };
|
// framePickerBack.AddChidren(colorPicker);
|
|
|
|
|
|
|
// //白点控件
|
// var btnWhiteRound = new Button();
|
// btnWhiteRound.Width = Application.GetRealWidth(24);
|
// btnWhiteRound.Height = Application.GetRealWidth(24);
|
// btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png";
|
// btnWhiteRound.Visible = false;
|
// framePickerBack.AddChidren(btnWhiteRound);
|
|
|
// //当前点击的【点】是否正确
|
// bool pointIsRight = false;
|
// //圆的半径(考虑边界,需要设置它的半径比较小一点)
|
// int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
|
|
|
// colorPicker.ColorChaged += (sender2, e2) => {
|
// rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
|
// //trait.value = rgbString;
|
// btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
|
// };
|
// colorPicker.MouseDownEventHandler += (sender, e) =>
|
// {
|
// pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
|
// if (pointIsRight == false)
|
// {
|
// //点的区域不是圆盘内
|
// return;
|
// }
|
// //显示白点
|
// btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
|
// btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
|
// if (btnWhiteRound.Visible == false)
|
// {
|
// btnWhiteRound.Visible = true;
|
// }
|
// };
|
|
// colorPicker.MouseMoveEventHandler += (sender, e) =>
|
// {
|
// //当鼠标点下事件处理
|
// colorPicker.MouseDownEventHandler(sender, e);
|
// };
|
|
|
// #endregion
|
|
|
|
|
// #region bottom View
|
// var bottomView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(52) + attrViewHight,
|
// Height = Application.GetRealHeight(46),
|
// };
|
// contentView.AddChidren(bottomView);
|
// bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
|
|
// var btnCancel = new Button()
|
// {
|
// Width = Application.GetRealWidth(172),
|
// Height = Application.GetRealHeight(44),
|
// TextAlignment = TextAlignment.Center,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// TextColor = CSS_Color.TextualColor,
|
// TextID = StringId.Cancel,
|
// };
|
// bottomView.AddChidren(btnCancel);
|
// btnCancel.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
|
// var btnComplete = new Button()
|
// {
|
// X = Application.GetRealWidth(172),
|
// Width = Application.GetRealWidth(172),
|
// Height = Application.GetRealHeight(46),
|
// BackgroundColor = CSS_Color.MainColor,
|
// TextColor = CSS_Color.MainBackgroundColor,
|
// TextAlignment = TextAlignment.Center,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// TextID = StringId.Complete
|
// };
|
// bottomView.AddChidren(btnComplete);
|
|
// //例:右下圆角 大小为50
|
// int mRectCornerID = HDLUtils.RectCornerBottomRight;
|
// btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
|
// btnComplete.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// trait.value = rgbString;
|
// btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
|
// };
|
|
// #endregion
|
|
|
// dialog.Show();
|
|
// }
|
|
|
// /// <summary>
|
// /// 检测点击点
|
// /// </summary>
|
// /// <param name="circleR">圆的半径</param>
|
// /// <param name="circleX">圆心X轴</param>
|
// /// <param name="circleY">圆心Y轴</param>
|
// /// <param name="pointX">点击点的X轴</param>
|
// /// <param name="pointY">点击点的Y轴</param>
|
// /// <returns></returns>
|
// private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY)
|
// {
|
// int dwidth = circleX - pointX;
|
// if (dwidth < 0) { dwidth *= -1; }
|
|
// int dHeight = circleY - pointY;
|
// if (dHeight < 0) { dHeight *= -1; }
|
|
// //根据三角函数,求三角形的斜边长
|
// int dlength = dwidth * dwidth + dHeight * dHeight;
|
// //半径长度(不开方,所以是按平方算)
|
// circleR *= circleR;
|
// if (dlength < circleR)
|
// {
|
// //如果组成的三角形并没有长过半径,则代表还在圆内(不允许点边界)
|
// return true;
|
// }
|
// return false;
|
// }
|
|
|
|
// /// <summary>
|
// /// 加载变化速度选择弹窗
|
// /// </summary>
|
// /// <param name="function"></param>
|
// /// <param name="btn"></param>
|
// void LoadEditDialog_FadeTime(SceneFunctionStatus trait, Button btn)
|
// {
|
// if (trait == null)
|
// {
|
// return;
|
// }
|
|
// Dialog dialog = new Dialog();
|
|
// var pView = new FrameLayout()
|
// {
|
// BackgroundColor = CSS_Color.DialogTransparentColor1,
|
// };
|
// dialog.AddChidren(pView);
|
|
// var optionBaseView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(467),
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(180),
|
// AnimateSpeed = 0.3f,
|
// Animate = Animate.DownToUp,
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// pView.AddChidren(optionBaseView);
|
|
// var topView = new FrameLayout()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(40),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// optionBaseView.AddChidren(topView);
|
// topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
// var btnTitle = new Button()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// TextAlignment = TextAlignment.Center,
|
// Width = Application.GetRealWidth(100),
|
// Text = trait.GetNameText(),
|
// IsBold = true,
|
// TextColor = CSS_Color.FirstLevelTitleColor,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// };
|
// topView.AddChidren(btnTitle);
|
|
// var btnCancel = new Button()
|
// {
|
// X = Application.GetRealWidth(21),
|
// Width = Application.GetRealWidth(100),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Cancel,
|
// };
|
// topView.AddChidren(btnCancel);
|
|
// var btnConfrim = new Button()
|
// {
|
// X = Application.GetRealWidth(200),
|
// Width = Application.GetRealWidth(120),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.MainColor,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Confirm,
|
// };
|
// topView.AddChidren(btnConfrim);
|
|
// Button btnMinusSignIcon = new Button()
|
// {
|
// X = Application.GetRealWidth(26),
|
// Y = Application.GetRealHeight(118),
|
// Width = Application.GetMinRealAverage(24),
|
// Height = Application.GetMinRealAverage(24),
|
// Text = "0s",
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
// };
|
// optionBaseView.AddChidren(btnMinusSignIcon);
|
|
// DiyImageSeekBar controlBar = new DiyImageSeekBar()
|
// {
|
// X = btnMinusSignIcon.Right + Application.GetRealWidth(12),
|
// Y = Application.GetRealHeight(100),//414,设计数据
|
// Width = Application.GetRealWidth(220),
|
// Height = Application.GetRealHeight(54),
|
// SeekBarViewHeight = Application.GetRealHeight(8),
|
// ThumbImagePath = "Public/ThumbImage.png",
|
// ThumbImageHeight = Application.GetRealHeight(54),
|
// ProgressBarColor = CSS_Color.MainColor,
|
// ProgressTextColor = CSS_Color.FirstLevelTitleColor,
|
// ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
// MaxValue = 100,
|
// Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32(trait.value.Replace("{}", "")),
|
// SeekBarPadding = Application.GetRealWidth(20),
|
// };
|
// optionBaseView.AddChidren(controlBar);
|
|
// Button btnPlusSgnIcon = new Button()
|
// {
|
// X = controlBar.Right + Application.GetRealWidth(12),
|
// Y = Application.GetRealHeight(118),
|
// Width = Application.GetMinRealAverage(24),
|
// Height = Application.GetMinRealAverage(24),
|
// Text = "10s",
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
// };
|
// optionBaseView.AddChidren(btnPlusSgnIcon);
|
|
// btnMinusSignIcon.MouseUpEventHandler = (sender, e) =>
|
// {
|
// controlBar.Progress--;
|
// };
|
// btnPlusSgnIcon.MouseUpEventHandler = (sender, e) =>
|
// {
|
// controlBar.Progress++;
|
// };
|
|
// dialog.Show();
|
// pView.MouseUpEventHandler = (sender, e) =>
|
// {
|
// dialog.Close();
|
// };
|
|
// btnCancel.MouseUpEventHandler = (sender, e) =>
|
// {
|
// dialog.Close();
|
// };
|
// btnConfrim.MouseUpEventHandler = (sender, e) =>
|
// {
|
// dialog.Close();
|
// trait.value = controlBar.Progress.ToString();
|
// btn.Text = trait.value + trait.GetUintString();
|
// };
|
// }
|
|
|
// /// <summary>
|
// /// 加载功能属性数据选择弹窗
|
// /// </summary>
|
// void LoadEditDialog_FunctionPar(SceneFunctionStatus trait, Button btn,List<string> statusList)
|
// {
|
// Button lastButton = new Button();
|
// var lastData = "";
|
// var lastText = "";
|
// Dialog dialog = new Dialog();
|
|
// if(DB_ResidenceData.Instance.GatewayType == 0)
|
// {
|
// if (SPK.AcSpkList().Contains(sceneFunction.localFunction.spk))
|
// {
|
// //0 制冷1制热,2通风,3自动,4除湿
|
// for (int i = 0; i < statusList.Count; i++)
|
// {
|
// if (statusList[i] == "0")
|
// {
|
// statusList[i] = "cool";
|
// }
|
// else if (statusList[i] == "1")
|
// {
|
// statusList[i] = "heat";
|
// }
|
// else if (statusList[i] == "2")
|
// {
|
// statusList[i] = "fan";
|
// }
|
// else if (statusList[i] == "3")
|
// {
|
// statusList[i] = "auto";
|
// }
|
// else if (statusList[i] == "4")
|
// {
|
// statusList[i] = "dry";
|
// }
|
// }
|
// }
|
// else if (SPK.FhSpkList().Contains(sceneFunction.localFunction.spk))
|
// {
|
// //1:普通,2:白天,3:夜晚,4:离开,5:时间
|
// for (int i = 0; i < statusList.Count; i++)
|
// {
|
// if (statusList[i] == "5")
|
// {
|
// statusList[i] = "timer";
|
// }
|
// else if (statusList[i] == "1")
|
// {
|
// statusList[i] = "normal";
|
// }
|
// else if (statusList[i] == "2")
|
// {
|
// statusList[i] = "day";
|
// }
|
// else if (statusList[i] == "3")
|
// {
|
// statusList[i] = "night";
|
// }
|
// else if (statusList[i] == "4")
|
// {
|
// statusList[i] = "away";
|
// }
|
// }
|
|
// }
|
// }
|
|
// var pView = new FrameLayout()
|
// {
|
// BackgroundColor = CSS_Color.DialogTransparentColor1,
|
// };
|
// dialog.AddChidren(pView);
|
|
// var optionBaseView = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(579 - 50 * statusList.Count),
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(50 * statusList.Count + 50),
|
// AnimateSpeed = 0.3f,
|
// Animate = Animate.DownToUp,
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// pView.AddChidren(optionBaseView);
|
|
// var topView = new FrameLayout()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// Width = Application.GetRealWidth(343),
|
// Height = Application.GetRealHeight(50),
|
// BackgroundColor = CSS_Color.MainBackgroundColor,
|
// Radius = (uint)Application.GetRealWidth(12),
|
// };
|
// optionBaseView.AddChidren(topView);
|
|
// var btnTitle = new Button()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// TextAlignment = TextAlignment.Center,
|
// Width = Application.GetRealWidth(100),
|
// Text = trait.GetNameText(),
|
// IsBold = true,
|
// TextColor = CSS_Color.FirstLevelTitleColor,
|
// TextSize = CSS_FontSize.SubheadingFontSize,
|
// };
|
// topView.AddChidren(btnTitle);
|
|
// var btnCancel = new Button()
|
// {
|
// X = Application.GetRealWidth(21),
|
// Width = Application.GetRealWidth(100),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.PromptingColor1,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Cancel,
|
// };
|
// topView.AddChidren(btnCancel);
|
|
// var btnConfrim = new Button()
|
// {
|
// X = Application.GetRealWidth(200),
|
// Width = Application.GetRealWidth(120),
|
// TextAlignment = TextAlignment.CenterRight,
|
// TextColor = CSS_Color.MainColor,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// TextID = StringId.Complete,
|
// };
|
// topView.AddChidren(btnConfrim);
|
// int hei = 1;
|
// foreach (var m in statusList)
|
// {
|
// var row = new FrameLayout()
|
// {
|
// Y = Application.GetRealHeight(50 * hei),
|
// Height = Application.GetRealHeight(50),
|
// };
|
// optionBaseView.AddChidren(row);
|
// if (statusList.Count > hei)
|
// {
|
// optionBaseView.AddChidren(new Button()
|
// {
|
// Gravity = Gravity.CenterHorizontal,
|
// Y = row.Bottom,
|
// Width = Application.GetRealWidth(343),
|
// BackgroundColor = CSS_Color.DividingLineColor,
|
// Height = 1,
|
// });
|
// }
|
// hei++;
|
|
// var btnChoose = new Button()
|
// {
|
// X = Application.GetRealWidth(303),
|
// Gravity = Gravity.CenterVertical,
|
// Width = Application.GetMinRealAverage(28),
|
// Height = Application.GetMinRealAverage(28),
|
// UnSelectedImagePath = "Public/ChooseIcon.png",
|
// SelectedImagePath = "Public/ChooseOnIcon.png",
|
|
// };
|
// row.AddChidren(btnChoose);
|
// if (trait.value == m)
|
// {
|
// lastButton = btnChoose;
|
// btnChoose.IsSelected = true;
|
// }
|
// var btnPropertyTitle = new Button()
|
// {
|
// X = Application.GetRealWidth(16),
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = CSS_Color.FirstLevelTitleColor,
|
// TextSize = CSS_FontSize.TextFontSize,
|
// Tag = m,
|
// Text = trait.GetValueText(m)
|
// };
|
// row.AddChidren(btnPropertyTitle);
|
|
// btnPropertyTitle.MouseUpEventHandler = (sender, e) => {
|
// btnChoose.IsSelected = true;
|
// if (lastButton != null)
|
// {
|
// lastButton.IsSelected = false;
|
// }
|
// lastButton = btnChoose;
|
// lastData = btnPropertyTitle.Tag.ToString();
|
// lastText = btnPropertyTitle.Text;
|
// };
|
// }
|
|
|
|
|
// dialog.Show();
|
|
// pView.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
|
// btnCancel.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// };
|
// btnConfrim.MouseUpEventHandler = (sender, e) => {
|
// dialog.Close();
|
// trait.value = lastData;
|
// //sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.curValue.ToString() ;
|
// btn.Text = lastText;
|
// };
|
|
// }
|
|
// #endregion
|
|
// }
|
//}
|
|
|
|
|
|
using System;
|
using HDL_ON.Entity;
|
using HDL_ON.UI.CSS;
|
using Shared;
|
using System.Collections.Generic;
|
|
namespace HDL_ON.UI
|
{
|
public class SceneFunctionInfoEditPage : FrameLayout
|
{
|
FrameLayout bodyView;
|
VerticalScrolViewLayout contentView;
|
Button btnOnText;
|
Button btnBrightnessText;
|
|
List<FrameLayout> functionRowList = new List<FrameLayout>();
|
|
|
Scene scene;
|
|
Action refreshAction;
|
SceneFunction sceneFunction;
|
|
bool isColorful = false;
|
SceneFunction rgbColorful;
|
bool isOnStatus = false;
|
|
public SceneFunctionInfoEditPage(Scene s, SceneFunction fc,Action action)
|
{
|
bodyView = this;
|
scene = s;
|
sceneFunction = fc.localFunction.ConvertSceneFunction();
|
foreach(var ll in sceneFunction.status)
|
{
|
try
|
{
|
var temp = fc.status.Find((obj) => obj.key == ll.key);
|
if (temp != null)
|
ll.value = temp.value;
|
}
|
catch { }
|
}
|
refreshAction = action;
|
}
|
|
public void LoadPage()
|
{
|
bodyView.BackgroundColor = CSS_Color.BackgroundColor;
|
|
new TopViewDiv(bodyView, sceneFunction.localFunction.name).LoadTopView();
|
|
contentView = new VerticalScrolViewLayout()
|
{
|
Y = Application.GetRealHeight(64),
|
Height = Application.GetRealHeight(520),
|
ScrollEnabled = false,
|
};
|
bodyView.AddChidren(contentView);
|
|
var onOffStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff);
|
if(onOffStatus.value == "on")
|
{
|
isOnStatus = true;
|
}
|
LoadFunctionRow(onOffStatus);
|
|
if (sceneFunction.localFunction.spk == SPK.LightRGB)
|
{
|
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)
|
{
|
switch (attr.key)
|
{
|
case FunctionAttributeKey.SetTemp:
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.SetTemp));
|
break;
|
case FunctionAttributeKey.Mode:
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Mode));
|
break;
|
case FunctionAttributeKey.FanSpeed:
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed));
|
break;
|
case FunctionAttributeKey.Percent:
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent));
|
break;
|
case FunctionAttributeKey.Brightness:
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness));
|
break;
|
case FunctionAttributeKey.FadeTime:
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.FadeTime));
|
break;
|
case FunctionAttributeKey.CCT:
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.CCT));
|
break;
|
case FunctionAttributeKey.RGB:
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.RGB));
|
break;
|
case "angle"://角度
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == "angle"));
|
break;
|
case "security"://大华摄像布防撤防
|
LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == "security"));
|
break;
|
}
|
}
|
|
if (DB_ResidenceData.Instance.GatewayType != 0)
|
{
|
//加载延时Row
|
LoadDelayRow();
|
}
|
var bottomView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(591),
|
Height = Application.GetRealHeight(106),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(16),
|
};
|
bodyView.AddChidren(bottomView);
|
|
var btnConfrim = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = Application.GetRealHeight(12),
|
Width = Application.GetRealWidth(220),
|
Height = Application.GetRealWidth(44),
|
TextAlignment = TextAlignment.Center,
|
TextColor = CSS_Color.MainBackgroundColor,
|
BackgroundColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
IsBold = true,
|
Radius = (uint) Application.GetRealWidth(22),
|
TextID = StringId.Complete
|
};
|
bottomView.AddChidren(btnConfrim);
|
|
btnConfrim.MouseUpEventHandler = (sender, e) =>
|
{
|
if (isOnStatus)
|
{
|
if (isColorful)
|
{
|
sceneFunction.status.Clear();
|
sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "on" });
|
sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.Colorful, value = "on" });
|
}
|
else
|
{
|
var isHasColorful = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful);
|
if (isHasColorful != null)
|
{
|
sceneFunction.status.Remove(isHasColorful);
|
}
|
}
|
}
|
else
|
{
|
if (isColorful) { } else { }
|
sceneFunction.status.Clear();
|
sceneFunction.status.Add(new SceneFunctionStatus() { key = FunctionAttributeKey.OnOff, value = "off" });
|
}
|
|
var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid);
|
|
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;
|
}
|
else
|
{
|
scene.functions.Add(sceneFunction);
|
}
|
if (!string.IsNullOrEmpty(scene.userSceneId))
|
{
|
var result = scene.UpdateScene();
|
if (result == DAL.Server.StateCode.SUCCESS)
|
{
|
refreshAction();
|
this.RemoveFromParent();
|
}
|
else
|
{
|
DAL.Server.IMessageCommon.Current.ShowErrorInfoAlter(result);
|
}
|
}
|
else
|
{
|
refreshAction();
|
this.RemoveFromParent();
|
}
|
};
|
|
|
UpdataFunctionRow();
|
}
|
|
void UpdataFunctionRow()
|
{
|
for(var i =0;i< functionRowList.Count; i++)
|
{
|
try
|
{
|
var view = functionRowList[i];
|
if(view!= null)
|
{
|
if(view.GetType() == typeof(FrameLayout))
|
{
|
if (view.Tag != null)
|
{
|
if (isOnStatus)
|
{
|
if (view.Tag.ToString() != FunctionAttributeKey.OnOff)
|
{
|
if (isColorful)
|
{
|
if(view.Tag.ToString() != FunctionAttributeKey.Colorful)
|
{
|
view.RemoveFromParent();
|
}
|
else
|
{
|
contentView.AddChidren(view);
|
}
|
}
|
else
|
{
|
contentView.AddChidren(view);
|
}
|
}
|
}
|
else
|
{
|
if (view.Tag.ToString() != FunctionAttributeKey.OnOff)
|
{
|
view.RemoveFromParent();
|
}
|
}
|
}
|
}
|
}
|
}catch(Exception ex)
|
{
|
MainPage.Log($"UpdataFuntionRow error:{ex.Message}");
|
}
|
}
|
}
|
|
|
/// <summary>
|
/// 加载功能Row
|
/// </summary>
|
void LoadFunctionRow(SceneFunctionStatus sceneStatus)
|
{
|
try
|
{
|
if (sceneStatus == null)
|
return;
|
#region Row code
|
var row = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(50),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Tag = sceneStatus.key,
|
};
|
contentView.AddChidren(row);
|
var view = functionRowList.Find((obj) => obj.Tag.ToString() == sceneStatus.key);
|
if (view == null)
|
{
|
functionRowList.Add(row);
|
}
|
|
|
if (sceneStatus.key != FunctionAttributeKey.OnOff)
|
{
|
row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
}
|
else
|
{
|
if (sceneStatus.value == "stop")
|
{
|
sceneStatus.value = "on";
|
}
|
}
|
Button btnRight = new Button()
|
{
|
X = Application.GetRealWidth(339),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
UnSelectedImagePath = "Public/Right.png",
|
};
|
row.AddChidren(btnRight);
|
|
|
var showCode = "";
|
|
if (sceneStatus.key == FunctionAttributeKey.Mode)
|
{
|
if (DB_ResidenceData.Instance.GatewayType == 0)
|
{
|
if (SPK.AcSpkList().Contains(sceneFunction.localFunction.spk))
|
{
|
//0 制冷1制热,2通风,3自动,4除湿
|
switch (sceneStatus.value)
|
{
|
case "0":
|
showCode = "cool";
|
break;
|
case "1":
|
showCode = "heat";
|
break;
|
case "2":
|
showCode = "fan";
|
break;
|
case "3":
|
showCode = "auto";
|
break;
|
case "4":
|
showCode = "dry";
|
break;
|
}
|
}
|
else if (SPK.FhSpkList().Contains(sceneFunction.localFunction.spk))
|
{
|
//1:普通,2:白天,3:夜晚,4:离开,5:时间
|
switch (sceneStatus.value)
|
{
|
case "5":
|
showCode = "timer";
|
break;
|
case "1":
|
showCode = "normal";
|
break;
|
case "2":
|
showCode = "day";
|
break;
|
case "3":
|
showCode = "night";
|
break;
|
case "4":
|
showCode = "away";
|
break;
|
}
|
}
|
}
|
}
|
|
var btnFunctionText = new Button()
|
{
|
Width = Application.GetRealWidth(330),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
Text = sceneStatus.GetValueText(showCode) + sceneStatus.GetUintString()
|
};
|
row.AddChidren(btnFunctionText);
|
if (sceneStatus.key == FunctionAttributeKey.RGB)
|
{
|
btnFunctionText.Width = Application.GetRealWidth(28);
|
btnFunctionText.Height = Application.GetRealWidth(28);
|
btnFunctionText.X = Application.GetRealWidth(330 - 28);
|
btnFunctionText.Gravity = Gravity.CenterVertical;
|
btnFunctionText.Radius = (uint)Application.GetRealWidth(8);
|
btnFunctionText.Text = "";
|
btnFunctionText.BackgroundColor = (uint)(0xFF000000 + new Light().GetRGBcolor(sceneStatus.value));
|
}
|
|
|
|
if (sceneStatus.key == FunctionAttributeKey.OnOff)
|
{
|
btnOnText = btnFunctionText;
|
}
|
else if (sceneStatus.key == FunctionAttributeKey.Brightness || sceneStatus.key == FunctionAttributeKey.Percent)
|
{
|
int outT = 0;
|
int.TryParse(sceneStatus.value, out outT);
|
if (outT < 0)
|
sceneStatus.value = "0";
|
btnBrightnessText = btnFunctionText;
|
}
|
|
var btnFunctionName = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
Text = sceneStatus.GetNameText()
|
};
|
row.AddChidren(btnFunctionName);
|
btnFunctionName.MouseUpEventHandler = (sender, e) =>
|
{
|
switch (sceneStatus.key)
|
{
|
case FunctionAttributeKey.Security:
|
LoadEditDialog_Security(sceneStatus, btnFunctionText);
|
break;
|
case FunctionAttributeKey.OnOff:
|
LoadEditDialog_OnOff(sceneStatus, btnFunctionText);
|
break;
|
case FunctionAttributeKey.Brightness:
|
LoadEditDialog_Percent(sceneStatus, btnFunctionText);
|
break;
|
case FunctionAttributeKey.Mode:
|
var statusList = new List<string>();
|
var tr = sceneFunction.localFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.Mode);
|
foreach (var t in tr.value)
|
{
|
statusList.Add(t);
|
}
|
LoadEditDialog_FunctionPar(sceneStatus, btnFunctionText, statusList);
|
break;
|
case FunctionAttributeKey.FanSpeed:
|
var fanStatusList = new List<string>();
|
var tr1 = sceneFunction.localFunction.attributes.Find((obj) => obj.key == FunctionAttributeKey.FanSpeed);
|
foreach (var t in tr1.value)
|
{
|
fanStatusList.Add(t);
|
}
|
LoadEditDialog_FunctionPar(sceneStatus, btnFunctionText, fanStatusList);
|
break;
|
case FunctionAttributeKey.SetTemp:
|
LoadEditDialog_Temp(sceneStatus, btnFunctionText);
|
break;
|
case FunctionAttributeKey.FadeTime:
|
|
break;
|
case "angle":
|
//呈现的弹窗
|
LoadEditDialog_Angle(sceneStatus, btnFunctionText);
|
|
break;
|
case "cct":
|
LoadEditDialog_CCT(sceneStatus, btnFunctionText);
|
break;
|
case FunctionAttributeKey.RGB:
|
btnFunctionText.Width = Application.GetRealWidth(28);
|
btnFunctionText.Height = Application.GetRealWidth(28);
|
btnFunctionText.X = Application.GetRealWidth(330 - 28);
|
btnFunctionText.Gravity = Gravity.CenterVertical;
|
btnFunctionText.Radius = (uint)Application.GetRealWidth(8);
|
btnFunctionText.Text = "";
|
|
LoadEditDialog_RGB_V2(sceneStatus, btnFunctionText);
|
break;
|
case FunctionAttributeKey.Percent:
|
LoadEditDialog_Percent(sceneStatus, btnFunctionText);
|
break;
|
}
|
};
|
|
#endregion
|
}catch(Exception ex)
|
{
|
MainPage.Log($"场景加载设备属性异常:{ex.Message}");
|
}
|
}
|
|
/// <summary>
|
/// 加载功能Row
|
/// </summary>
|
void LoadColorfulRow(SceneFunctionStatus sceneStatus)
|
{
|
if (sceneStatus == null)
|
return;
|
#region Row code
|
var row = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(50),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Tag = sceneStatus.key
|
};
|
contentView.AddChidren(row);
|
var view = functionRowList.Find((obj) => obj.Tag.ToString() == sceneStatus.key);
|
if (view == null)
|
{
|
functionRowList.Add(row);
|
}
|
|
row.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
|
Button btnRight = new Button()
|
{
|
X = Application.GetRealWidth(339),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
UnSelectedImagePath = "Public/Right.png",
|
};
|
row.AddChidren(btnRight);
|
|
|
var showCode = "";
|
|
var btnFunctionText = new Button()
|
{
|
Width = Application.GetRealWidth(330),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
Text = sceneStatus.GetValueText(showCode)
|
};
|
row.AddChidren(btnFunctionText);
|
|
var btnFunctionName = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.ColorfulFunction
|
};
|
row.AddChidren(btnFunctionName);
|
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
|
}
|
|
#region 加载功能场景数据调节界面
|
/// <summary>
|
/// 加载延时Row
|
/// </summary>
|
void LoadDelayRow()
|
{
|
#region 延时row
|
FrameLayout delayRow = new FrameLayout()
|
{
|
Height = Application.GetRealWidth(50),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Tag = "delay"
|
};
|
contentView.AddChidren(delayRow);
|
var view = functionRowList.Find((obj) => obj.Tag.ToString() == "delay");
|
if (view == null)
|
{
|
functionRowList.Add(delayRow);
|
}
|
delayRow.AddChidren(new Button() { X = Application.GetRealWidth(16), Height = Application.GetRealHeight(1), Width = Application.GetRealWidth(343), BackgroundColor = CSS_Color.DividingLineColor });
|
|
Button btnDelayRight = new Button()
|
{
|
X = Application.GetRealWidth(339),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(16),
|
Height = Application.GetMinRealAverage(16),
|
UnSelectedImagePath = "Public/Right.png",
|
};
|
delayRow.AddChidren(btnDelayRight);
|
|
var btnDelayInfo = new Button()
|
{
|
Width = Application.GetRealWidth(327),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
Text = new Scene() { delay = sceneFunction.delay }.GetDelayText()
|
};
|
delayRow.AddChidren(btnDelayInfo);
|
|
Button btnSceneDelayTitle = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.Delay,
|
};
|
delayRow.AddChidren(btnSceneDelayTitle);
|
|
|
btnSceneDelayTitle.MouseUpEventHandler = (sender, e) => {
|
Action<string> action = (obj) => {
|
sceneFunction.delay = obj;
|
btnDelayInfo.Text = new Scene() { delay = sceneFunction.delay }.GetDelayText();
|
};
|
Dictionary<string, string> items = new Dictionary<string, string>();
|
items.Add("30", "30s");
|
items.Add("60", "1min");
|
items.Add("120", "2min");
|
items.Add("300", "5min");
|
new PublicAssmebly().SetSceneDelayDialog(action, sceneFunction.delay);
|
};
|
#endregion
|
|
|
}
|
|
#endregion
|
|
#region 属性选择弹窗
|
/// <summary>
|
/// 加载开关选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_OnOff(SceneFunctionStatus trait, Button btn)
|
{
|
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.On,
|
IsSelected = trait.value.ToString() == "on"
|
};
|
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.OFF,
|
IsSelected = trait.value.ToString() == "off"
|
};
|
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();
|
trait.value = "on";
|
isOnStatus = true;
|
try
|
{
|
sceneFunction.status.Find((obj) => obj.key == trait.key).value = "on";
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"场景配置异常:{ex.Message}");
|
}
|
|
try
|
{
|
btn.Text = trait.GetValueText() + trait.GetUintString();
|
if (trait.key == FunctionAttributeKey.OnOff)
|
{
|
var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
|
if (temp == null)
|
{
|
temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
|
}
|
if (temp != null)
|
{
|
if (temp.value == "0")
|
{
|
temp.value = "100";
|
}
|
if (btnBrightnessText != null)
|
{
|
btnBrightnessText.Text = temp.GetValueText() + "%";
|
}
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"场景配置异常2:{ex.Message}");
|
}
|
try
|
{
|
if (trait.key == FunctionAttributeKey.Colorful)
|
{
|
isColorful = true;
|
}
|
else if (trait.key == FunctionAttributeKey.OnOff)
|
{
|
isOnStatus = true;
|
}
|
UpdataFunctionRow();
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"场景配置异常3:{ex.Message}");
|
}
|
};
|
btnOff.MouseUpEventHandler = (sender, e) =>
|
{
|
dialog.Close();
|
trait.value = "off";
|
try
|
{
|
sceneFunction.status.Find((obj) => obj.key == trait.key).value = "off";
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"场景配置异常:{ex.Message}");
|
}
|
|
try
|
{
|
btn.Text = trait.GetValueText() + trait.GetUintString();
|
if (trait.key == FunctionAttributeKey.OnOff)
|
{
|
isOnStatus = false;
|
var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness);
|
if (temp == null)
|
{
|
temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Percent);
|
}
|
if (temp != null)
|
{
|
if (temp.value != "0")
|
{
|
temp.value = "0";
|
}
|
if (btnBrightnessText != null)
|
btnBrightnessText.Text = temp.GetValueText() + "%";
|
}
|
}
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"场景配置异常2:{ex.Message}");
|
}
|
|
try
|
{
|
if (trait.key == FunctionAttributeKey.Colorful)
|
{
|
isColorful = false;
|
}
|
else if (trait.key == FunctionAttributeKey.OnOff)
|
{
|
isOnStatus = false;
|
}
|
UpdataFunctionRow();
|
}
|
catch (Exception ex)
|
{
|
MainPage.Log($"场景配置异常3:{ex.Message}");
|
}
|
};
|
|
}
|
|
|
/// <summary>
|
/// 加载安防布防选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_Security(SceneFunctionStatus trait, Button btn)
|
{
|
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.Defense,
|
IsSelected = trait.value.ToString() == "true"
|
};
|
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.Undefense,
|
IsSelected = trait.value.ToString() == "false"
|
};
|
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();
|
trait.value = "true";
|
sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "true";
|
btn.Text = trait.GetValueText() + trait.GetUintString();
|
|
};
|
btnOff.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
trait.value = "false";
|
sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Security).value = "false";
|
btn.Text = trait.GetValueText() + trait.GetUintString();
|
|
};
|
|
}
|
|
|
/// <summary>
|
/// 加载温度选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_Temp(SceneFunctionStatus trait, Button btn)
|
{
|
double temp = trait.min;
|
double.TryParse(trait.value, out temp);
|
trait.value = temp.ToString();
|
|
List<string> pickerItems = new List<string>();
|
if(trait == null)
|
{
|
return;
|
}
|
|
Dialog dialog = new Dialog();
|
|
var pView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
dialog.AddChidren(pView);
|
|
var optionBaseView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(456-60),
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(260),
|
AnimateSpeed = 0.3f,
|
Animate = Animate.DownToUp,
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
pView.AddChidren(optionBaseView);
|
|
var topView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(40),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
optionBaseView.AddChidren(topView);
|
topView.AddChidren(new Button() {Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
var btnCancel = new Button()
|
{
|
X = Application.GetRealWidth(21),
|
Width = Application.GetRealWidth(100),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Cancel,
|
};
|
topView.AddChidren(btnCancel);
|
|
var btnConfrim = new Button()
|
{
|
X = Application.GetRealWidth(160),
|
Width = Application.GetRealWidth(160),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Confirm,
|
};
|
topView.AddChidren(btnConfrim);
|
|
UIPickerView uIPickerView = new UIPickerView()
|
{
|
Y = Application.GetRealHeight(40),
|
Height = Application.GetRealHeight(210),
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
for (int i = trait.min; i <= trait.max; i += 1)
|
{
|
pickerItems.Add(i.ToString() + trait.GetUintString());
|
}
|
uIPickerView.setNPicker(pickerItems, null, null);
|
optionBaseView.AddChidren(uIPickerView);
|
uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
|
|
string selectItem = pickerItems[0];
|
if (pickerItems.Contains(trait.value + trait.GetUintString()))
|
{
|
selectItem = trait.value.ToString() + trait.GetUintString();
|
}
|
|
dialog.Show();
|
|
pView.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
|
btnCancel.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
|
selectItem = pickerItems[int1];
|
};
|
btnConfrim.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
btn.Text = selectItem;
|
//sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
|
trait.value = selectItem.Replace(trait.GetUintString(),"");
|
};
|
|
}
|
|
/// <summary>
|
/// 加载温度选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_Angle (SceneFunctionStatus trait, Button btn)
|
{
|
double temp = trait.min;
|
double.TryParse(trait.value, out temp);
|
trait.value = temp.ToString();
|
|
List<string> pickerItems = new List<string>();
|
if (trait == null)
|
{
|
return;
|
}
|
|
Dialog dialog = new Dialog();
|
|
var pView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
dialog.AddChidren(pView);
|
|
var optionBaseView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(456 - 60),
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(260),
|
AnimateSpeed = 0.3f,
|
Animate = Animate.DownToUp,
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
pView.AddChidren(optionBaseView);
|
|
var topView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(40),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
optionBaseView.AddChidren(topView);
|
topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
var btnCancel = new Button()
|
{
|
X = Application.GetRealWidth(21),
|
Width = Application.GetRealWidth(100),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Cancel,
|
};
|
topView.AddChidren(btnCancel);
|
|
|
var btnConfrim = new Button()
|
{
|
X = Application.GetRealWidth(160),
|
Width = Application.GetRealWidth(160),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Confirm,
|
};
|
topView.AddChidren(btnConfrim);
|
|
UIPickerView uIPickerView = new UIPickerView()
|
{
|
Y = Application.GetRealHeight(40),
|
Height = Application.GetRealHeight(210),
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
for (int i = trait.min; i <= trait.max; i += 1)
|
{
|
pickerItems.Add(i.ToString() + trait.GetUintString());
|
}
|
uIPickerView.setNPicker(pickerItems, null, null);
|
optionBaseView.AddChidren(uIPickerView);
|
uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()+ "°"), 0, 0);
|
|
string selectItem = pickerItems[pickerItems.IndexOf(trait.value.ToString() + "°")];
|
if (pickerItems.Contains(trait.value + trait.GetUintString()))
|
{
|
selectItem = trait.value.ToString() + trait.GetUintString();
|
}
|
//uIPickerView.setCurrentItems
|
dialog.Show();
|
|
pView.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
|
btnCancel.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
|
selectItem = pickerItems[int1];
|
};
|
btnConfrim.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
btn.Text = selectItem;
|
//sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
|
trait.value = selectItem.Replace(trait.GetUintString(), "");
|
};
|
|
}
|
|
|
/// <summary>
|
/// 加载亮度选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_Percent(SceneFunctionStatus trait, Button btn)
|
{
|
if (trait == null)
|
{
|
return;
|
}
|
|
Dialog dialog = new Dialog();
|
|
var pView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
dialog.AddChidren(pView);
|
|
var optionBaseView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(467),
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(180),
|
AnimateSpeed = 0.3f,
|
Animate = Animate.DownToUp,
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
pView.AddChidren(optionBaseView);
|
|
var topView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(40),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
optionBaseView.AddChidren(topView);
|
topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
var btnTitle = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
TextAlignment = TextAlignment.Center,
|
Width = Application.GetRealWidth(100),
|
Text = trait.GetNameText(),
|
IsBold = true,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
};
|
topView.AddChidren(btnTitle);
|
|
var btnCancel = new Button()
|
{
|
X = Application.GetRealWidth(21),
|
Width = Application.GetRealWidth(100),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Cancel,
|
};
|
topView.AddChidren(btnCancel);
|
|
var btnConfrim = new Button()
|
{
|
Width = Application.GetRealWidth(320),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Confirm,
|
};
|
topView.AddChidren(btnConfrim);
|
|
Button btnMinusSignIcon = new Button()
|
{
|
X = Application.GetRealWidth(26),
|
Y = Application.GetRealHeight(118),
|
Width = Application.GetMinRealAverage(24),
|
Height = Application.GetMinRealAverage(24),
|
UnSelectedImagePath = "Public/MinusSignIcon.png",
|
};
|
optionBaseView.AddChidren(btnMinusSignIcon);
|
|
DiyImageSeekBar controlBar = new DiyImageSeekBar()
|
{
|
X = btnMinusSignIcon.Right + Application.GetRealWidth(12),
|
Y = Application.GetRealHeight(100),//414,设计数据
|
Width = Application.GetRealWidth(220),
|
Height = Application.GetRealHeight(54),
|
SeekBarViewHeight = Application.GetRealHeight(8),
|
ThumbImagePath = "Public/ThumbImage.png",
|
ThumbImageHeight = Application.GetRealHeight(54),
|
ProgressBarColor = CSS_Color.MainColor,
|
ProgressTextColor = CSS_Color.FirstLevelTitleColor,
|
ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
MaxValue = 100,
|
Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32(trait.value.Replace("{}", "")),
|
SeekBarPadding = Application.GetRealWidth(20),
|
};
|
optionBaseView.AddChidren(controlBar);
|
|
Button btnPlusSgnIcon = new Button()
|
{
|
X = controlBar.Right + Application.GetRealWidth(12),
|
Y = Application.GetRealHeight(118),
|
Width = Application.GetMinRealAverage(24),
|
Height = Application.GetMinRealAverage(24),
|
UnSelectedImagePath = "Public/PlusSignIcon.png",
|
};
|
optionBaseView.AddChidren(btnPlusSgnIcon);
|
|
btnMinusSignIcon.MouseUpEventHandler = (sender, e) =>
|
{
|
controlBar.Progress--;
|
};
|
btnPlusSgnIcon.MouseUpEventHandler = (sender, e) =>
|
{
|
controlBar.Progress++;
|
};
|
|
dialog.Show();
|
pView.MouseUpEventHandler = (sender, e) =>
|
{
|
dialog.Close();
|
};
|
|
btnCancel.MouseUpEventHandler = (sender, e) =>
|
{
|
dialog.Close();
|
};
|
btnConfrim.MouseUpEventHandler = (sender, e) =>
|
{
|
dialog.Close();
|
trait.value = controlBar.Progress.ToString();
|
btn.Text = trait.value + trait.GetUintString();
|
|
var temp = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff);
|
if (temp != null)
|
{
|
if (controlBar.Progress > 0)
|
{
|
temp.value = "on";
|
}
|
else
|
{
|
temp.value = "off";
|
}
|
btnOnText.Text = temp.GetValueText();
|
}
|
};
|
}
|
|
|
/// <summary>
|
/// 加载cct选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_CCT(SceneFunctionStatus trait, Button btn)
|
{
|
double temp = trait.min;
|
double.TryParse(trait.value, out temp);
|
trait.value = temp.ToString();
|
|
List<string> pickerItems = new List<string>();
|
if (trait == null)
|
{
|
return;
|
}
|
|
Dialog dialog = new Dialog();
|
|
var pView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
dialog.AddChidren(pView);
|
|
var optionBaseView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(456 - 60),
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(260),
|
AnimateSpeed = 0.3f,
|
Animate = Animate.DownToUp,
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
pView.AddChidren(optionBaseView);
|
|
var topView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(40),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
optionBaseView.AddChidren(topView);
|
topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
var btnCancel = new Button()
|
{
|
X = Application.GetRealWidth(21),
|
Width = Application.GetRealWidth(100),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Cancel,
|
};
|
topView.AddChidren(btnCancel);
|
|
var btnConfrim = new Button()
|
{
|
Width = Application.GetRealWidth(320),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Confirm,
|
};
|
topView.AddChidren(btnConfrim);
|
|
UIPickerView uIPickerView = new UIPickerView()
|
{
|
Y = Application.GetRealHeight(40),
|
Height = Application.GetRealHeight(210),
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
for (int i = trait.min; i <= trait.max; i += 100)
|
{
|
pickerItems.Add(i.ToString() + trait.GetUintString());
|
}
|
uIPickerView.setNPicker(pickerItems, null, null);
|
optionBaseView.AddChidren(uIPickerView);
|
uIPickerView.setCurrentItems(pickerItems.IndexOf(trait.value.ToString()), 4, 5);
|
|
string selectItem = pickerItems[0];
|
if (pickerItems.Contains(trait.value + trait.GetUintString()))
|
{
|
selectItem = trait.value.ToString() + trait.GetUintString();
|
}
|
|
dialog.Show();
|
|
pView.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
|
btnCancel.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
uIPickerView.OnSelectChangeEvent = (int1, int2, int3) => {
|
selectItem = pickerItems[int1];
|
};
|
btnConfrim.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
btn.Text = selectItem;
|
//sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.value.ToString() ;
|
trait.value = selectItem.Replace(trait.GetUintString(), "");
|
};
|
|
}
|
|
|
/// <summary>
|
/// 加载rgb选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_RGB(SceneFunctionStatus trait, Button btn)
|
{
|
string rgbString = trait.value;
|
|
Light tempLight = new Light();
|
|
if (trait == null)
|
{
|
return;
|
}
|
|
Dialog dialog = new Dialog();
|
|
var bodyView = new FrameLayout();
|
dialog.AddChidren(bodyView);
|
|
var contentView = new FrameLayout()
|
{
|
Gravity = Gravity.Center,
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(52 + 44 + 18 + 22 + 248),
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
bodyView.AddChidren(contentView);
|
|
#region 标题区
|
var titleView = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(52),
|
};
|
contentView.AddChidren(titleView);
|
|
var btnTitle = new Button()
|
{
|
Height = Application.GetRealHeight(52),
|
Gravity = Gravity.Center,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextColor = CSS_Color.MainColor,
|
TextID = StringId.ColorValue,
|
TextAlignment = TextAlignment.Center,
|
};
|
titleView.AddChidren(btnTitle);
|
titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) });
|
|
#endregion
|
|
int attrViewHight = Application.GetRealHeight(18 + 22+ 248);
|
//属性设置区域
|
var attrView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(52),
|
Width = Application.GetRealWidth(343),
|
Height = attrViewHight
|
};
|
contentView.AddChidren(attrView);
|
attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
|
|
|
|
#region RGB
|
var rgbView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(248)
|
};
|
attrView.AddChidren(rgbView);
|
|
|
var btnCurColor = new Button()
|
{
|
X = Application.GetRealWidth(24),
|
Y = Application.GetRealHeight(10),
|
Width = Application.GetMinRealAverage(24),
|
Height = Application.GetMinRealAverage(24),
|
Radius = (uint)Application.GetMinRealAverage(8),
|
BorderColor = CSS_Color.PromptingColor2,
|
BorderWidth = 1,
|
BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(trait.value))
|
};
|
rgbView.AddChidren(btnCurColor);
|
|
//色盘的桌布控件(限制那个白色滑动球使用)
|
var framePickerBack = new FrameLayout();
|
framePickerBack.Gravity = Gravity.CenterHorizontal;
|
framePickerBack.Y = Application.GetRealHeight(20);
|
framePickerBack.Width = Application.GetMinRealAverage(198);
|
framePickerBack.Height = Application.GetMinRealAverage(198);
|
rgbView.AddChidren(framePickerBack);
|
|
var colorPicker = new ColorPicker()
|
{
|
ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
|
};
|
framePickerBack.AddChidren(colorPicker);
|
|
|
|
|
|
|
//白点控件
|
var btnWhiteRound = new Button();
|
btnWhiteRound.Width = Application.GetRealWidth(24);
|
btnWhiteRound.Height = Application.GetRealWidth(24);
|
btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png";
|
btnWhiteRound.Visible = false;
|
framePickerBack.AddChidren(btnWhiteRound);
|
|
|
//当前点击的【点】是否正确
|
bool pointIsRight = false;
|
//圆的半径(考虑边界,需要设置它的半径比较小一点)
|
int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
|
|
|
colorPicker.ColorChaged += (sender2, e2) => {
|
rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
|
//trait.value = rgbString;
|
btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
|
};
|
colorPicker.MouseDownEventHandler += (sender, e) =>
|
{
|
pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
|
if (pointIsRight == false)
|
{
|
//点的区域不是圆盘内
|
return;
|
}
|
//显示白点
|
btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
|
btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
|
if (btnWhiteRound.Visible == false)
|
{
|
btnWhiteRound.Visible = true;
|
}
|
};
|
|
colorPicker.MouseMoveEventHandler += (sender, e) =>
|
{
|
//当鼠标点下事件处理
|
colorPicker.MouseDownEventHandler(sender, e);
|
};
|
|
|
#endregion
|
|
|
|
|
#region bottom View
|
var bottomView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(52) + attrViewHight,
|
Height = Application.GetRealHeight(46),
|
};
|
contentView.AddChidren(bottomView);
|
bottomView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
|
|
var btnCancel = new Button()
|
{
|
Width = Application.GetRealWidth(172),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.Center,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextColor = CSS_Color.TextualColor,
|
TextID = StringId.Cancel,
|
};
|
bottomView.AddChidren(btnCancel);
|
btnCancel.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
|
var btnComplete = new Button()
|
{
|
X = Application.GetRealWidth(172),
|
Width = Application.GetRealWidth(172),
|
Height = Application.GetRealHeight(46),
|
BackgroundColor = CSS_Color.MainColor,
|
TextColor = CSS_Color.MainBackgroundColor,
|
TextAlignment = TextAlignment.Center,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextID = StringId.Complete
|
};
|
bottomView.AddChidren(btnComplete);
|
|
//例:右下圆角 大小为50
|
int mRectCornerID = HDLUtils.RectCornerBottomRight;
|
btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
|
btnComplete.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
trait.value = rgbString;
|
btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
|
};
|
|
#endregion
|
|
|
dialog.Show();
|
|
}
|
|
|
/// <summary>
|
/// 加载rgb选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_RGB_V2(SceneFunctionStatus trait, Button btn)
|
{
|
string rgbString = trait.value;
|
|
Light tempLight = new Light();
|
|
if (trait == null)
|
{
|
return;
|
}
|
|
Dialog dialog = new Dialog() {
|
Height = Application.GetRealHeight(647),
|
};
|
|
var bodyView = new FrameLayout();
|
dialog.AddChidren(bodyView);
|
|
var contentView = new FrameLayout()
|
{
|
Gravity = Gravity.BottomCenter,
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(300),
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
bodyView.AddChidren(contentView);
|
|
#region 标题区
|
var titleView = new FrameLayout()
|
{
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(52),
|
};
|
contentView.AddChidren(titleView);
|
|
var btnTitle = new Button()
|
{
|
Height = Application.GetRealHeight(52),
|
Gravity = Gravity.Center,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
TextColor = CSS_Color.MainColor,
|
Text = "RGB",
|
TextAlignment = TextAlignment.Center,
|
};
|
titleView.AddChidren(btnTitle);
|
titleView.AddChidren(new Button() { Height = 1, BackgroundColor = CSS_Color.DividingLineColor, Y = Application.GetRealHeight(51) });
|
|
#endregion
|
|
int attrViewHight = Application.GetRealHeight(245);
|
//属性设置区域
|
var attrView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(52),
|
Width = Application.GetRealWidth(343),
|
Height = attrViewHight
|
};
|
contentView.AddChidren(attrView);
|
attrView.AddChidren(new Button() { Height = Application.GetRealHeight(18) });
|
|
#region RGB
|
var rgbView = new FrameLayout()
|
{
|
Height = Application.GetRealHeight(248)
|
};
|
attrView.AddChidren(rgbView);
|
|
var btnCurColor = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
Y = Application.GetRealHeight(10),
|
Width = Application.GetMinRealAverage(24),
|
Height = Application.GetMinRealAverage(24),
|
Radius = (uint)Application.GetMinRealAverage(8),
|
BorderColor = CSS_Color.PromptingColor2,
|
BorderWidth = 1,
|
BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(trait.value))
|
};
|
rgbView.AddChidren(btnCurColor);
|
|
//色盘的桌布控件(限制那个白色滑动球使用)
|
var framePickerBack = new FrameLayout();
|
framePickerBack.Gravity = Gravity.CenterHorizontal;
|
framePickerBack.Y = Application.GetRealHeight(20);
|
framePickerBack.Width = Application.GetMinRealAverage(198);
|
framePickerBack.Height = Application.GetMinRealAverage(198);
|
rgbView.AddChidren(framePickerBack);
|
|
var colorPicker = new ColorPicker()
|
{
|
ColorImagePath = "FunctionIcon/Light/ColorWheel.png",
|
};
|
framePickerBack.AddChidren(colorPicker);
|
|
|
//白点控件
|
var btnWhiteRound = new Button();
|
btnWhiteRound.Width = Application.GetRealWidth(24);
|
btnWhiteRound.Height = Application.GetRealWidth(24);
|
btnWhiteRound.UnSelectedImagePath = "FunctionIcon/Light/ColorWheelTip.png";
|
btnWhiteRound.Visible = false;
|
framePickerBack.AddChidren(btnWhiteRound);
|
|
|
//当前点击的【点】是否正确
|
bool pointIsRight = false;
|
//圆的半径(考虑边界,需要设置它的半径比较小一点)
|
int circleR = colorPicker.Width / 2 - Application.GetRealWidth(12);
|
|
|
colorPicker.ColorChaged += (sender2, e2) => {
|
rgbString = (e2[0] + "," + e2[1] + "," + e2[2]).ToString();
|
//trait.value = rgbString;
|
btnCurColor.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
|
};
|
colorPicker.MouseDownEventHandler += (sender, e) =>
|
{
|
pointIsRight = this.CheckPoint(circleR, colorPicker.Width / 2, colorPicker.Height / 2, (int)e.X, (int)e.Y);
|
if (pointIsRight == false)
|
{
|
//点的区域不是圆盘内
|
return;
|
}
|
//显示白点
|
btnWhiteRound.X = (int)e.X - btnWhiteRound.Width / 2;
|
btnWhiteRound.Y = (int)e.Y - btnWhiteRound.Height / 2;
|
if (btnWhiteRound.Visible == false)
|
{
|
btnWhiteRound.Visible = true;
|
}
|
};
|
|
colorPicker.MouseMoveEventHandler += (sender, e) =>
|
{
|
//当鼠标点下事件处理
|
colorPicker.MouseDownEventHandler(sender, e);
|
};
|
|
|
#endregion
|
|
#region
|
var btnCancel = new Button()
|
{
|
X = Application.GetRealWidth(20),
|
Width = Application.GetRealWidth(100),
|
Height = Application.GetRealHeight(44),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextColor = CSS_Color.TextualColor,
|
TextID = StringId.Cancel,
|
};
|
titleView.AddChidren(btnCancel);
|
btnCancel.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
|
var btnComplete = new Button()
|
{
|
X = Application.GetRealWidth(223),
|
Width = Application.GetRealWidth(100),
|
Height = Application.GetRealHeight(46),
|
TextColor = CSS_Color.MainColor,
|
TextAlignment = TextAlignment.CenterRight,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Complete
|
};
|
titleView.AddChidren(btnComplete);
|
|
//例:右下圆角 大小为50
|
int mRectCornerID = HDLUtils.RectCornerBottomRight;
|
btnComplete.SetCornerWithSameRadius((uint)Application.GetRealWidth(14), mRectCornerID);
|
btnComplete.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
trait.value = rgbString;
|
btn.BackgroundColor = (uint)(0xFF000000 + tempLight.GetRGBcolor(rgbString));
|
};
|
|
#endregion
|
|
|
dialog.Show();
|
|
}
|
|
|
/// <summary>
|
/// 检测点击点
|
/// </summary>
|
/// <param name="circleR">圆的半径</param>
|
/// <param name="circleX">圆心X轴</param>
|
/// <param name="circleY">圆心Y轴</param>
|
/// <param name="pointX">点击点的X轴</param>
|
/// <param name="pointY">点击点的Y轴</param>
|
/// <returns></returns>
|
private bool CheckPoint(int circleR, int circleX, int circleY, int pointX, int pointY)
|
{
|
int dwidth = circleX - pointX;
|
if (dwidth < 0) { dwidth *= -1; }
|
|
int dHeight = circleY - pointY;
|
if (dHeight < 0) { dHeight *= -1; }
|
|
//根据三角函数,求三角形的斜边长
|
int dlength = dwidth * dwidth + dHeight * dHeight;
|
//半径长度(不开方,所以是按平方算)
|
circleR *= circleR;
|
if (dlength < circleR)
|
{
|
//如果组成的三角形并没有长过半径,则代表还在圆内(不允许点边界)
|
return true;
|
}
|
return false;
|
}
|
|
|
|
/// <summary>
|
/// 加载变化速度选择弹窗
|
/// </summary>
|
/// <param name="function"></param>
|
/// <param name="btn"></param>
|
void LoadEditDialog_FadeTime(SceneFunctionStatus trait, Button btn)
|
{
|
if (trait == null)
|
{
|
return;
|
}
|
|
Dialog dialog = new Dialog();
|
|
var pView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
dialog.AddChidren(pView);
|
|
var optionBaseView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(467),
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(180),
|
AnimateSpeed = 0.3f,
|
Animate = Animate.DownToUp,
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
pView.AddChidren(optionBaseView);
|
|
var topView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(40),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
optionBaseView.AddChidren(topView);
|
topView.AddChidren(new Button() { Y = Application.GetRealHeight(39), Height = Application.GetRealHeight(1), BackgroundColor = CSS_Color.DividingLineColor });
|
|
var btnTitle = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
TextAlignment = TextAlignment.Center,
|
Width = Application.GetRealWidth(100),
|
Text = trait.GetNameText(),
|
IsBold = true,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
};
|
topView.AddChidren(btnTitle);
|
|
var btnCancel = new Button()
|
{
|
X = Application.GetRealWidth(21),
|
Width = Application.GetRealWidth(100),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Cancel,
|
};
|
topView.AddChidren(btnCancel);
|
|
var btnConfrim = new Button()
|
{
|
Width = Application.GetRealWidth(320),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Confirm,
|
};
|
topView.AddChidren(btnConfrim);
|
|
Button btnMinusSignIcon = new Button()
|
{
|
X = Application.GetRealWidth(26),
|
Y = Application.GetRealHeight(118),
|
Width = Application.GetMinRealAverage(24),
|
Height = Application.GetMinRealAverage(24),
|
Text = "0s",
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
};
|
optionBaseView.AddChidren(btnMinusSignIcon);
|
|
DiyImageSeekBar controlBar = new DiyImageSeekBar()
|
{
|
X = btnMinusSignIcon.Right + Application.GetRealWidth(12),
|
Y = Application.GetRealHeight(100),//414,设计数据
|
Width = Application.GetRealWidth(220),
|
Height = Application.GetRealHeight(54),
|
SeekBarViewHeight = Application.GetRealHeight(8),
|
ThumbImagePath = "Public/ThumbImage.png",
|
ThumbImageHeight = Application.GetRealHeight(54),
|
ProgressBarColor = CSS_Color.MainColor,
|
ProgressTextColor = CSS_Color.FirstLevelTitleColor,
|
ProgressTextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
MaxValue = 100,
|
Progress = trait.value.ToString().Replace("{}", "") == "" ? 0 : Convert.ToInt32(trait.value.Replace("{}", "")),
|
SeekBarPadding = Application.GetRealWidth(20),
|
};
|
optionBaseView.AddChidren(controlBar);
|
|
Button btnPlusSgnIcon = new Button()
|
{
|
X = controlBar.Right + Application.GetRealWidth(12),
|
Y = Application.GetRealHeight(118),
|
Width = Application.GetMinRealAverage(24),
|
Height = Application.GetMinRealAverage(24),
|
Text = "10s",
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.PromptFontSize_FirstLevel,
|
};
|
optionBaseView.AddChidren(btnPlusSgnIcon);
|
|
btnMinusSignIcon.MouseUpEventHandler = (sender, e) =>
|
{
|
controlBar.Progress--;
|
};
|
btnPlusSgnIcon.MouseUpEventHandler = (sender, e) =>
|
{
|
controlBar.Progress++;
|
};
|
|
dialog.Show();
|
pView.MouseUpEventHandler = (sender, e) =>
|
{
|
dialog.Close();
|
};
|
|
btnCancel.MouseUpEventHandler = (sender, e) =>
|
{
|
dialog.Close();
|
};
|
btnConfrim.MouseUpEventHandler = (sender, e) =>
|
{
|
dialog.Close();
|
trait.value = controlBar.Progress.ToString();
|
btn.Text = trait.value + trait.GetUintString();
|
};
|
}
|
|
|
/// <summary>
|
/// 加载功能属性数据选择弹窗
|
/// </summary>
|
void LoadEditDialog_FunctionPar(SceneFunctionStatus trait, Button btn,List<string> statusList)
|
{
|
Button lastButton = new Button();
|
var lastData = "";
|
var lastText = "";
|
Dialog dialog = new Dialog();
|
|
if(DB_ResidenceData.Instance.GatewayType == 0)
|
{
|
if (SPK.AcSpkList().Contains(sceneFunction.localFunction.spk))
|
{
|
//0 制冷1制热,2通风,3自动,4除湿
|
for (int i = 0; i < statusList.Count; i++)
|
{
|
if (statusList[i] == "0")
|
{
|
statusList[i] = "cool";
|
}
|
else if (statusList[i] == "1")
|
{
|
statusList[i] = "heat";
|
}
|
else if (statusList[i] == "2")
|
{
|
statusList[i] = "fan";
|
}
|
else if (statusList[i] == "3")
|
{
|
statusList[i] = "auto";
|
}
|
else if (statusList[i] == "4")
|
{
|
statusList[i] = "dry";
|
}
|
}
|
}
|
else if (SPK.FhSpkList().Contains(sceneFunction.localFunction.spk))
|
{
|
//1:普通,2:白天,3:夜晚,4:离开,5:时间
|
for (int i = 0; i < statusList.Count; i++)
|
{
|
if (statusList[i] == "5")
|
{
|
statusList[i] = "timer";
|
}
|
else if (statusList[i] == "1")
|
{
|
statusList[i] = "normal";
|
}
|
else if (statusList[i] == "2")
|
{
|
statusList[i] = "day";
|
}
|
else if (statusList[i] == "3")
|
{
|
statusList[i] = "night";
|
}
|
else if (statusList[i] == "4")
|
{
|
statusList[i] = "away";
|
}
|
}
|
|
}
|
}
|
|
var pView = new FrameLayout()
|
{
|
BackgroundColor = CSS_Color.DialogTransparentColor1,
|
};
|
dialog.AddChidren(pView);
|
|
var optionBaseView = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(579 - 50 * statusList.Count),
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(50 * statusList.Count + 50),
|
AnimateSpeed = 0.3f,
|
Animate = Animate.DownToUp,
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
pView.AddChidren(optionBaseView);
|
|
var topView = new FrameLayout()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Width = Application.GetRealWidth(343),
|
Height = Application.GetRealHeight(50),
|
BackgroundColor = CSS_Color.MainBackgroundColor,
|
Radius = (uint)Application.GetRealWidth(12),
|
};
|
optionBaseView.AddChidren(topView);
|
|
var btnTitle = new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
TextAlignment = TextAlignment.Center,
|
Width = Application.GetRealWidth(100),
|
Text = trait.GetNameText(),
|
IsBold = true,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.SubheadingFontSize,
|
};
|
topView.AddChidren(btnTitle);
|
|
var btnCancel = new Button()
|
{
|
X = Application.GetRealWidth(21),
|
Width = Application.GetRealWidth(100),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.PromptingColor1,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Cancel,
|
};
|
topView.AddChidren(btnCancel);
|
|
var btnConfrim = new Button()
|
{
|
Width = Application.GetRealWidth(320),
|
TextAlignment = TextAlignment.CenterRight,
|
TextColor = CSS_Color.MainColor,
|
TextSize = CSS_FontSize.TextFontSize,
|
TextID = StringId.Complete,
|
};
|
topView.AddChidren(btnConfrim);
|
int hei = 1;
|
foreach (var m in statusList)
|
{
|
var row = new FrameLayout()
|
{
|
Y = Application.GetRealHeight(50 * hei),
|
Height = Application.GetRealHeight(50),
|
};
|
optionBaseView.AddChidren(row);
|
if (statusList.Count > hei)
|
{
|
optionBaseView.AddChidren(new Button()
|
{
|
Gravity = Gravity.CenterHorizontal,
|
Y = row.Bottom,
|
Width = Application.GetRealWidth(343),
|
BackgroundColor = CSS_Color.DividingLineColor,
|
Height = 1,
|
});
|
}
|
hei++;
|
|
var btnChoose = new Button()
|
{
|
X = Application.GetRealWidth(303),
|
Gravity = Gravity.CenterVertical,
|
Width = Application.GetMinRealAverage(28),
|
Height = Application.GetMinRealAverage(28),
|
UnSelectedImagePath = "Public/ChooseIcon.png",
|
SelectedImagePath = "Public/ChooseOnIcon.png",
|
|
};
|
row.AddChidren(btnChoose);
|
if (trait.value == m)
|
{
|
lastButton = btnChoose;
|
btnChoose.IsSelected = true;
|
}
|
var btnPropertyTitle = new Button()
|
{
|
X = Application.GetRealWidth(16),
|
TextAlignment = TextAlignment.CenterLeft,
|
TextColor = CSS_Color.FirstLevelTitleColor,
|
TextSize = CSS_FontSize.TextFontSize,
|
Tag = m,
|
Text = trait.GetValueText(m)
|
};
|
row.AddChidren(btnPropertyTitle);
|
|
btnPropertyTitle.MouseUpEventHandler = (sender, e) => {
|
btnChoose.IsSelected = true;
|
if (lastButton != null)
|
{
|
lastButton.IsSelected = false;
|
}
|
lastButton = btnChoose;
|
lastData = btnPropertyTitle.Tag.ToString();
|
lastText = btnPropertyTitle.Text;
|
};
|
}
|
|
|
|
|
dialog.Show();
|
|
pView.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
|
btnCancel.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
};
|
btnConfrim.MouseUpEventHandler = (sender, e) => {
|
dialog.Close();
|
trait.value = lastData;
|
//sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff).value = trait.curValue.ToString() ;
|
btn.Text = lastText;
|
};
|
|
}
|
|
#endregion
|
|
}
|
}
|
|
|
|