From af9c3e0b3b1eb370e966b3ca9db3f62848d4189b Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期六, 21 八月 2021 13:03:12 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/newBranch1' into WJC --- HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs | 340 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 321 insertions(+), 19 deletions(-) diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs index d80b17d..a883705 100644 --- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs +++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/ArmCenterPage.cs @@ -1,7 +1,9 @@ 锘縰sing System; +using HDL_ON.DriverLayer; +using HDL_ON.Entity; using HDL_ON.UI.CSS; using Shared; -namespace HDL_ON.UI.UI2.FuntionControlView.ArmCenter +namespace HDL_ON.UI { public class ArmCenterPage : FrameLayout { @@ -9,6 +11,11 @@ /// 涓荤獥浣� /// </summary> FrameLayout bodyView; + /// <summary> + /// 鑷畾涔夊竷闃插尯鍩� + /// </summary> + HorizontalScrolViewLayout customDeploymentView; + public ArmCenterPage() { bodyView = this; @@ -20,11 +27,12 @@ }; - new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView_ArmCenter(skipAction); + new TopViewDiv(bodyView, Language.StringByID(StringId.SecurityCenter)).LoadTopView_ArmCenter(skipAction); VerticalScrolViewLayout contentView = new VerticalScrolViewLayout() { - Height = Application.GetRealHeight(603), + Y = Application.GetRealHeight(64), + Height = Application.GetRealHeight(667 - 64), BackgroundColor = CSS_Color.MainBackgroundColor, ScrollEnabled = false, }; @@ -51,6 +59,34 @@ Height = Application.GetRealWidth(16), }); + + #region 鎾ら槻鍖哄煙 + var disarmView = new FrameLayout() + { + Height = 0, + }; + contentView.AddChidren(disarmView); + + var btnDisarm = new Button() + { + Width = Application.GetRealWidth(120), + Height = Application.GetRealHeight(44), + BackgroundColor = CSS_Color.WarningColor, + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainBackgroundColor, + Text = "鎾ら槻" + }; + disarmView.AddChidren(btnDisarm); + btnDisarm.MouseUpEventHandler = (sender, e) => { + if (SecurityCenter.Security.CurrentDefenseMode != null) + { + Control.Ins.ControlSecurity(SecurityCenter.Security.CurrentDefenseMode, "disable"); + } + }; + + #endregion + + #region 鑷畾涔夊竷闃� //鑷畾涔夊竷闃叉爣棰� Button btnCustomDeploymentTitle = new Button() { @@ -64,12 +100,86 @@ }; contentView.AddChidren(btnCustomDeploymentTitle); - HorizontalScrolViewLayout customDeploymentView = new HorizontalScrolViewLayout() + customDeploymentView = new HorizontalScrolViewLayout() { X = Application.GetRealWidth(23), Height = Application.GetRealWidth(80), + ScrollEnabled = false, }; contentView.AddChidren(customDeploymentView); + + iniCustomDeploymentView(); + + + #endregion + + contentView.AddChidren(new Button() + { + Height = Application.GetRealHeight(20), + }); + + #region 鍥哄畾甯冮槻鍖哄煙 + /* + var fixedDeploymentView = new FrameLayout() + { + Height = Application.GetRealHeight(133), + }; + contentView.AddChidren(fixedDeploymentView); + + Button btnFixedDeploymentTitle = new Button() + { + X = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + TextAlignment = TextAlignment.CenterLeft, + IsBold = true, + TextSize = CSS_FontSize.SubheadingFontSize, + TextColor = CSS_Color.FirstLevelTitleColor, + TextID = StringId.FixedDeployment, + }; + fixedDeploymentView.AddChidren(btnFixedDeploymentTitle); + + Button btnFixedDeploymentTip = new Button() + { + X = Application.GetRealWidth(24), + Y = btnFixedDeploymentTitle.Bottom, + Height = Application.GetRealWidth(19), + TextAlignment = TextAlignment.CenterLeft, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + TextColor = CSS_Color.MainColor, + TextID = StringId.UndoDefenseDoesNotAffect + }; + fixedDeploymentView.AddChidren(btnFixedDeploymentTip); + + var fixedDeploymentTypeView = new HorizontalScrolViewLayout() + { + Y = btnFixedDeploymentTip.Bottom + Application.GetRealHeight(15), + Height = Application.GetRealHeight(80), + ScrollEnabled = false, + }; + fixedDeploymentView.AddChidren(fixedDeploymentTypeView); + + fixedDeploymentTypeView.AddChidren(new Button() + { + Width = Application.GetRealWidth(24), + }); + + #endregion + + + //鐏惧鎶ヨ + var disasterAlarmView = new FixedArmView("FunctionIcon/ArmCenter/DisasterAlarmIcon.png", Language.StringByID(StringId.DisasterDefense), Language.StringByID(StringId.Defense24Hour)); + fixedDeploymentTypeView.AddChidren(disasterAlarmView); + + fixedDeploymentTypeView.AddChidren(new Button() + { + Width = Application.GetRealWidth(30), + }); + + //闃茬洍鎶ヨ + var burglarAlarmView = new FixedArmView("FunctionIcon/ArmCenter/BurglarAlarmIcon.png", Language.StringByID(StringId.BurglarAlarm), Language.StringByID(StringId.AlarmMute)); + fixedDeploymentTypeView.AddChidren(burglarAlarmView); + */ + #endregion @@ -78,30 +188,159 @@ } + + /// <summary> + /// 鍒濆鍖栬嚜瀹氫箟甯冮槻鍖哄煙 + /// </summary> + private void iniCustomDeploymentView() + { + customDeploymentView.RemoveAll(); + + foreach (var mode in FunctionList.List.securities) + { + var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png", + mode.name); + customDeploymentView.AddChidren(armDiyView); + EventHandler<MouseEventArgs> event2 = (sender, e) => + { + ShowArmDialog(mode); + }; + armDiyView.SetClickEvent(event2); + } + + if (FunctionList.List.securities.Count < 4) + { + var view = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png", + Language.StringByID(StringId.Custom)); + customDeploymentView.AddChidren(view); + EventHandler<MouseEventArgs> event1 = (sender, e) => + { + Action refreshAction = () => + { + iniCustomDeploymentView(); + }; + + var addDefensePage = new AddAlarmDeploymentPage(new SecurityAlarm(), refreshAction); + MainPage.BasePageView.AddChidren(addDefensePage); + addDefensePage.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + view.SetClickEvent(event1); + } + + } + + private void ShowArmDialog(SecurityAlarm alarm) + { + Dialog dialog = new Dialog(); + + FrameLayout contentView = new FrameLayout(); + dialog.AddChidren(contentView); + contentView.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + VerticalScrolViewLayout optinView = new VerticalScrolViewLayout() { + Gravity = Gravity.CenterHorizontal, + Y = Application.GetRealHeight(515), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(88), + Radius = (uint)Application.GetRealHeight(13), + BackgroundColor = CSS_Color.MainBackgroundColor, + }; + contentView.AddChidren(optinView); + + Button btnOpen = new Button() + { + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.MainColor, + TextSize = CSS_FontSize.SubheadingFontSize, + TextID = StringId.OpenArm + }; + optinView.AddChidren(btnOpen); + + optinView.AddChidren(new Button() { + Height = 1, + BackgroundColor = CSS_Color.DividingLineColor + }); + + Button btnCheckModify = new Button() + { + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.Center, + TextColor = CSS_Color.PromptingColor1, + TextID = StringId.CheckModify, + TextSize = CSS_FontSize.SubheadingFontSize, + }; + optinView.AddChidren(btnCheckModify); + + + Button btnCancel = new Button() + { + Gravity = Gravity.CenterHorizontal, + Y = optinView.Bottom + Application.GetRealHeight(8), + Width = Application.GetRealWidth(343), + Height = Application.GetRealHeight(44), + Radius = (uint)Application.GetRealHeight(13), + BackgroundColor = CSS_Color.MainBackgroundColor, + TextID = StringId.Cancel, + TextColor = CSS_Color.WarningColor, + IsBold = true, + }; + contentView.AddChidren(btnCancel); + + dialog.Show(); + + btnOpen.MouseUpEventHandler = (sender, e) => { + Control.Ins.ControlSecurity(alarm, "enable"); + dialog.Close(); + }; + + + btnCheckModify.MouseUpEventHandler = (sender, e) => { + dialog.Close(); + Action refreshAction = () => + { + iniCustomDeploymentView(); + }; + var armSetPage = new ArmDeploymentSettingPage(alarm,refreshAction); + MainPage.BasePageView.AddChidren(armSetPage); + armSetPage.LoadPage(); + MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; + }; + + btnCancel.MouseUpEventHandler = (sender, e) => + { + dialog.Close(); + }; + + } + + } /// <summary> /// 瀹夐槻鑷畾涔夋帶浠� /// </summary> - public class ArmDiyView + public class ArmDiyView : FrameLayout { - public FrameLayout ArmDiyButton; - + Button btnIcon; + Button btnText; /// <summary> - /// + /// 鑷畾涔夊竷闃茬晫闈� /// </summary> - /// <param name="IconPath">鍥剧墖璺緞</param> + /// <param name="UnSelectedIconPath">鍥剧墖璺緞</param> + /// <param name="SelectedIconPath">鍥剧墖璺緞</param> /// <param name="Text">鏄剧ず鏂囨湰</param> public ArmDiyView(string UnSelectedIconPath, string SelectedIconPath, string Text) { - ArmDiyButton = new FrameLayout() - { - Width = Application.GetRealWidth(82), - Height = Application.GetRealWidth(80), - }; + this.Width = Application.GetRealWidth(82); + this.Height = Application.GetRealWidth(80); - Button btnIcon = new Button() + btnIcon = new Button() { Gravity = Gravity.CenterHorizontal, Width = Application.GetRealWidth(40), @@ -109,9 +348,9 @@ UnSelectedImagePath = UnSelectedIconPath, SelectedImagePath = SelectedIconPath, }; - ArmDiyButton.AddChidren(btnIcon); + this.AddChidren(btnIcon); - Button btnText = new Button() + btnText = new Button() { Y = Application.GetRealWidth(40), Height = Application.GetRealWidth(41), @@ -120,9 +359,72 @@ TextColor = CSS_Color.TextualColor, TextSize = CSS_FontSize.PromptFontSize_FirstLevel, }; - ArmDiyButton.AddChidren(btnText); + this.AddChidren(btnText); + } + + public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) + { + this.MouseUpEventHandler = eventHandler; + btnIcon.MouseUpEventHandler = eventHandler; + btnText.MouseUpEventHandler = eventHandler; + } + + + } + + public class FixedArmView : FrameLayout + { + /// <summary> + /// 鍥哄畾甯冮槻鎺т欢 + /// </summary> + /// <param name="iconPath"></param> + /// <param name="title"></param> + /// <param name="titleTip"></param> + public FixedArmView(string iconPath, string title, string titleTip) + { + this.Width = Application.GetRealWidth(144); + this.Height = Application.GetRealHeight(66); + this.Radius = (uint)Application.GetRealWidth(6); + this.BorderColor = CSS_Color.MainColor; + this.BorderWidth = 1; + + var btnIcon = new Button() + { + X = Application.GetRealWidth(15), + Width = Application.GetRealWidth(24), + Height = Application.GetRealWidth(24), + Gravity = Gravity.CenterVertical, + UnSelectedImagePath = iconPath,// "FunctionIcon/ArmCenter/DisasterAlarmIcon.png", + }; + this.AddChidren(btnIcon); + + var btnTitle = new Button() + { + X = Application.GetRealWidth(55), + Width = Application.GetRealWidth(89), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.FirstLevelTitleColor, + TextSize = CSS_FontSize.TextFontSize, + Text = title, + IsBold = true, + }; + this.AddChidren(btnTitle); + + var btnTitleTip = new Button() + { + X = Application.GetRealWidth(55), + Y = Application.GetRealHeight(23), + Width = Application.GetRealWidth(89), + Height = Application.GetRealHeight(44), + TextAlignment = TextAlignment.CenterLeft, + TextColor = CSS_Color.PromptingColor1, + TextSize = CSS_FontSize.PromptFontSize_FirstLevel, + Text = titleTip, + }; + this.AddChidren(btnTitleTip); } - } + } -- Gitblit v1.8.0