From e1a8f2f7e4d850beedeb1469610b878c1427e976 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 15 十二月 2021 09:01:53 +0800
Subject: [PATCH] 更新
---
HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs | 181 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 173 insertions(+), 8 deletions(-)
diff --git a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs
index a872383..c3332b1 100644
--- a/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs
+++ b/HDL_ON/UI/UI2/FuntionControlView/ArmCenter/AddAlarmDeploymentPage.cs
@@ -132,10 +132,11 @@
};
delayedRow.AddChidren(btnDelayedTitle);
btnDelayedTitle.Text += ":";
+ btnDelayedTitle.Width = btnDelayedTitle.GetTextWidth()+Application.GetRealWidth(10);
var btnDelayedText = new Button()
{
- X = Application.GetRealWidth(88),
+ X = btnDelayedTitle.Right,
Width = Application.GetRealWidth(330),
TextAlignment = TextAlignment.CenterLeft,
TextColor = CSS_Color.TextualColor,
@@ -213,6 +214,7 @@
UnSelectedImagePath = "LogicIcon/off.png",
SelectedImagePath = "LogicIcon/on.png",
Gravity = Gravity.CenterVertical,
+ IsSelected = securityAlarm.noticeConfig.enable
};
pushView.AddChidren(btnSwitchPush);
@@ -471,15 +473,17 @@
inputTargetView.RemoveAll();
if (securityAlarm.input.Count > 0)
{
+ int count = 0;
foreach (var target in securityAlarm.input)
{
if (target.GetFunction() != null)
{
inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName(), target.StateText()));
- }
inputTargetView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
+ }
+ count++;
}
- inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count);
+ inputTargetView.Height = Application.GetRealHeight(65 * count);
}
else
{
@@ -578,9 +582,19 @@
{
foreach (var outTarget in securityAlarm.output)
{
- if (outTarget.GetFunction() != null)
+ if (outTarget.NoLocalData())
{
- outputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(), outTarget.StateText()));
+ var outputRow = new OutputRow(outTarget.name, outTarget.RoomName, outTarget);
+ EventHandler<MouseEventArgs> eventHandler = (sender, e) => {
+ var delTemp = securityAlarm.output.Find((obj) => obj.sid == outTarget.sid);
+ if(delTemp!=null)
+ {
+ securityAlarm.output.Remove(delTemp);
+ }
+ outputRow.RemoveFromParent();
+ outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count);
+ };
+ outputTargetView.AddChidren(outputRow);
}
outputTargetView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor });
}
@@ -710,8 +724,14 @@
Button btnRightIcon;
- public OutputRow(string title, string subtitle, string state)
+ Button btnDel;
+
+ SecurityOutput output;
+
+ public OutputRow(string title, string subtitle, SecurityOutput inOutput)
{
+ output = inOutput;
+
this.LineColor = 0x00000000;
this.Height = Application.GetRealHeight(65);
this.BackgroundColor = CSS_Color.MainBackgroundColor;
@@ -747,7 +767,7 @@
TextAlignment = TextAlignment.CenterRight,
TextSize = CSS_FontSize.TextFontSize,
TextColor = CSS_Color.PromptingColor1,
- Text = state
+ Text = output.StateText()
};
this.AddChidren(btnState);
@@ -759,7 +779,43 @@
Height = Application.GetRealWidth(16),
UnSelectedImagePath = "FunctionIcon/ArmCenter/RightIcon.png",
};
- this.AddChidren(btnRightIcon);
+ if (!string.IsNullOrEmpty(output.spk))
+ {
+ this.AddChidren(btnRightIcon);
+ }
+
+ btnState.MouseUpEventHandler = (sender, e) =>
+ {
+ if (!string.IsNullOrEmpty(output.spk))
+ {
+ ShowStateDialog();
+ }
+ };
+ btnRightIcon.MouseUpEventHandler = (sender, e) =>
+ {
+ if (!string.IsNullOrEmpty(output.spk))
+ {
+ ShowStateDialog();
+ }
+ };
+ //btnSubTitle.MouseUpEventHandler = (sender, e) =>
+ //{
+ // ShowStateDialog();
+ //};
+
+ btnDel = new Button()
+ {
+ BackgroundColor = CSS_Color.WarningColor,
+ TextColor = CSS_Color.MainBackgroundColor,
+ TextID = StringId.Del,
+ };
+ this.AddRightView(btnDel);
+
+ }
+
+ public void SetDelClick(EventHandler<MouseEventArgs> eventHandler)
+ {
+ btnDel.MouseUpEventHandler = eventHandler;
}
public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler)
@@ -768,5 +824,114 @@
btnTitle.MouseUpEventHandler = eventHandler;
btnSubTitle.MouseUpEventHandler = eventHandler;
}
+
+
+
+
+ private void ShowStateDialog()
+ {
+ 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,
+ SelectedTextColor = CSS_Color.MainColor,
+ TextColor = CSS_Color.PromptingColor1,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ TextID = StringId.On,
+ };
+ optinView.AddChidren(btnOpen);
+ optinView.AddChidren(new Button()
+ {
+ Height = 1,
+ BackgroundColor = CSS_Color.DividingLineColor
+ });
+
+ Button btnClose = new Button()
+ {
+ Height = Application.GetRealHeight(44),
+ TextAlignment = TextAlignment.Center,
+ SelectedTextColor = CSS_Color.MainColor,
+ TextColor = CSS_Color.PromptingColor1,
+ TextID = StringId.OFF,
+ TextSize = CSS_FontSize.SubheadingFontSize,
+ };
+ optinView.AddChidren(btnClose);
+ if (output.status.Count > 0)
+ {
+ btnOpen.IsSelected = output.status[0].value.ToLower() == "on";
+ btnClose.IsSelected = !btnOpen.IsSelected;
+ }
+
+
+ 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) => {
+ btnState.Text = btnOpen.Text;
+ output.status = new List<SecurityOutputStatus>()
+ {
+ new SecurityOutputStatus()
+ {
+ key = FunctionAttributeKey.OnOff,
+ value = "on",
+ }
+ };
+ dialog.Close();
+ };
+
+ btnClose.MouseUpEventHandler = (sender, e) =>
+ {
+ btnState.Text = btnClose.Text;
+ output.status = new List<SecurityOutputStatus>()
+ {
+ new SecurityOutputStatus()
+ {
+ key = FunctionAttributeKey.OnOff,
+ value = "off",
+ }
+ };
+ dialog.Close();
+ };
+
+ btnCancel.MouseUpEventHandler = (sender, e) =>
+ {
+ dialog.Close();
+ };
+
+ }
+
}
}
--
Gitblit v1.8.0