| | |
| | | |
| | | Action refreshAction; |
| | | SceneFunction sceneFunction; |
| | | |
| | | bool isColorful = false; |
| | | |
| | | public SceneFunctionInfoEditPage(Scene s, SceneFunction fc,Action action) |
| | | { |
| | | bodyView = this; |
| | | scene = s; |
| | | sceneFunction = fc; |
| | | 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; |
| | | } |
| | | |
| | |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | LoadFunctionRow(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff)); |
| | | var onOffStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff); |
| | | |
| | | foreach (var attr in sceneFunction.status) |
| | | LoadFunctionRow(onOffStatus); |
| | | |
| | | if (sceneFunction.localFunction.spk == SPK.LightRGB) |
| | | { |
| | | switch (attr.key) |
| | | var colorfulStatus = sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Colorful); |
| | | if (colorfulStatus != null) |
| | | { |
| | | 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; |
| | | isColorful = true; |
| | | LoadColorfulRow(colorfulStatus); |
| | | } |
| | | } |
| | | |
| | | //加载开关Row |
| | | //LoadFunctionRow(sceneFunction.localFunction.trait_on_off); |
| | | //switch (sceneFunction.localFunction.functionType) |
| | | //{ |
| | | // case SPK.AcStandard: |
| | | // LoadFunctionRow(sceneFunction.localFunction.attributes.Find((obj) => obj.key == "set_temp")); |
| | | // LoadFunctionRow(sceneFunction.localFunction.attributes.Find((obj) => obj.key == "mode")); |
| | | // LoadFunctionRow(sceneFunction.localFunction.attributes.Find((obj) => obj.key == "fan")); |
| | | // break; |
| | | // case SPK.FloorHeatStandard: |
| | | // LoadFunctionRow(sceneFunction.localFunction.attributes.Find((obj) => obj.key == "set_temp")); |
| | | // LoadFunctionRow(sceneFunction.localFunction.attributes.Find((obj) => obj.key == "mode")); |
| | | // break; |
| | | // case SPK.CurtainSwitch: |
| | | // //无操作 |
| | | // break; |
| | | // case SPK.CurtainTrietex: |
| | | // case SPK.CurtainRoller: |
| | | // LoadFunctionRow(sceneFunction.localFunction.attributes.Find((obj) => obj.key == "percent")); |
| | | // break; |
| | | // case SPK.LightSwitch: |
| | | // //无操作 |
| | | // break; |
| | | // case SPK.LightDimming: |
| | | // case SPK.LightRGB: |
| | | // LoadFunctionRow(sceneFunction.localFunction.attributes.Find((obj) => obj.key == "brightness")); |
| | | // break; |
| | | //} |
| | | |
| | | if (DB_ResidenceData.Instance.GatewayType != 0) |
| | | if(!isColorful) |
| | | { |
| | | //加载延时Row |
| | | LoadDelayRow(); |
| | | } |
| | | 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), |
| | |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | var temp = scene.functions.Find((obj) => obj.sid == sceneFunction.sid); |
| | | //if (sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.Brightness) != null) |
| | | //{ |
| | | // try |
| | | // { |
| | | // //一端口不支持开关值与亮度值一起处理,需要将开关值移除掉 |
| | | // sceneFunction.status.Remove(sceneFunction.status.Find((obj) => obj.key == FunctionAttributeKey.OnOff)); |
| | | // } |
| | | // catch { } |
| | | //} |
| | | |
| | | if (temp != null) |
| | | { |
| | |
| | | { |
| | | switch (sceneStatus.key) |
| | | { |
| | | case FunctionAttributeKey.Security: |
| | | LoadEditDialog_Security(sceneStatus, btnFunctionText); |
| | | break; |
| | | case FunctionAttributeKey.OnOff: |
| | | LoadEditDialog_OnOff(sceneStatus, btnFunctionText); |
| | | break; |
| | |
| | | break; |
| | | case "angle": |
| | | //呈现的弹窗 |
| | | LoadEditDialog_Angle(sceneStatus, btnFunctionText); |
| | | |
| | | break; |
| | | case "cct": |
| | |
| | | |
| | | #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> |
| | | /// 加载安防布防选择弹窗 |
| | | /// </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> |
| | |
| | | |
| | | var btnConfrim = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(320), |
| | | X = Application.GetRealWidth(160), |
| | | Width = Application.GetRealWidth(160), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextColor = CSS_Color.MainColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | |
| | | }; |
| | | |
| | | } |
| | | |
| | | /// <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> |
| | | /// 加载cct选择弹窗 |
| | | /// </summary> |