| | |
| | | SecurityAlarm securityAlarm; |
| | | Action refreshAction; |
| | | |
| | | /// <summary> |
| | | /// 安防输出-临时 |
| | | /// </summary> |
| | | List<SecurityOutput> tempOutput = new List<SecurityOutput>(); |
| | | /// <summary> |
| | | /// 安防输入-临时 |
| | | /// </summary> |
| | | List<SecurityInput> tempInput = new List<SecurityInput>(); |
| | | |
| | | |
| | | |
| | | public AddAlarmDeploymentPage(SecurityAlarm alarm, Action action) |
| | | { |
| | |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedTitle); |
| | | btnDelayedTitle.Text += ":"; |
| | | btnDelayedTitle.Width = btnDelayedTitle.GetTextWidth()+Application.GetRealWidth(10); |
| | | btnDelayedTitle.Width = btnDelayedTitle.GetTextWidth() + Application.GetRealWidth(10); |
| | | |
| | | var btnDelayedText = new Button() |
| | | { |
| | |
| | | else |
| | | { |
| | | new TopViewDiv(bodyView, title).LoadTopView(); |
| | | securityAlarm.status = "enable"; |
| | | } |
| | | |
| | | //布防功能 |
| | |
| | | tip.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | if (securityAlarm.output.Count == 0) |
| | | { |
| | | var tipText = "请选择告警目标"; |
| | | if(Language.CurrentLanguage !="Chinese") |
| | | { |
| | | tipText = "Please select the alarm target"; |
| | | } |
| | | var tip = new Tip() |
| | | { |
| | | Text = tipText, |
| | | CloseTime = 3, |
| | | Direction = AMPopTipDirection.None |
| | | }; |
| | | tip.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | //if (securityAlarm.output.Count == 0) |
| | | //{ |
| | | // var tipText = "请选择告警目标"; |
| | | // if(Language.CurrentLanguage !="Chinese") |
| | | // { |
| | | // tipText = "Please select the alarm target"; |
| | | // } |
| | | // var tip = new Tip() |
| | | // { |
| | | // Text = tipText, |
| | | // CloseTime = 3, |
| | | // Direction = AMPopTipDirection.None |
| | | // }; |
| | | // tip.Show(MainPage.BaseView); |
| | | // return; |
| | | //} |
| | | |
| | | var waitPage = new Loading(); |
| | | waitPage.Start(); |
| | |
| | | { |
| | | 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 }); |
| | | var inputView = new InputRow(target); |
| | | inputTargetView.AddChidren(inputView); |
| | | inputView.InitView(); |
| | | EventHandler<MouseEventArgs> eventHandler = (sener, e) => { |
| | | securityAlarm.input.Remove(target); |
| | | iniInputTargetView(); |
| | | }; |
| | | inputView.SetDelClickeEvent(eventHandler); |
| | | inputTargetView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | } |
| | | count++; |
| | | } |
| | |
| | | }; |
| | | contentView.AddChidren(outputTargetView); |
| | | |
| | | outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); |
| | | iniAlarmListView(); |
| | | |
| | | #endregion |
| | |
| | | private void iniAlarmListView() |
| | | { |
| | | outputTargetView.RemoveAll(); |
| | | |
| | | if (securityAlarm.output.Count > 0) |
| | | { |
| | | |
| | | if (securityAlarm.type == "all_day" || securityAlarm.type == "mute") |
| | | { } |
| | | else |
| | | { |
| | | |
| | | #region 告警延时 |
| | | var delayedRow = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | outputTargetView.AddChidren(delayedRow); |
| | | |
| | | var btnDelayedTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(72), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.DelayAlarm, |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedTitle); |
| | | btnDelayedTitle.Text += ":"; |
| | | btnDelayedTitle.Width = btnDelayedTitle.GetTextWidth() + Application.GetRealWidth(10); |
| | | |
| | | var btnDelayedText = new Button() |
| | | { |
| | | X = btnDelayedTitle.Right, |
| | | Width = Application.GetRealWidth(330), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = securityAlarm.output_delay + "s" |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedText); |
| | | btnDelayedText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | Action<string> action = (obj) => |
| | | { |
| | | securityAlarm.output_delay = obj; |
| | | btnDelayedText.Text = securityAlarm.output_delay + "s"; |
| | | }; |
| | | new PublicAssmebly().SetSceneDelayDialog(action, securityAlarm.output_delay); |
| | | }; |
| | | |
| | | var btnDelayedRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(343), |
| | | Gravity = Gravity.CenterVertical, |
| | | Width = Application.GetMinRealAverage(16), |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/RightIcon.png", |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedRight); |
| | | |
| | | |
| | | delayedRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | #endregion |
| | | } |
| | | |
| | | |
| | | foreach (var outTarget in securityAlarm.output) |
| | | { |
| | | if (outTarget.NoLocalData()) |
| | | if (outTarget.LocalData()) |
| | | { |
| | | var outputRow = new OutputRow(outTarget.name, outTarget.RoomName, outTarget); |
| | | var outputRow = new OutputRow( outTarget); |
| | | outputTargetView.AddChidren(outputRow); |
| | | outputRow.InitView(outTarget.name, outTarget.RoomName); |
| | | EventHandler<MouseEventArgs> eventHandler = (sender, e) => { |
| | | var delTemp = securityAlarm.output.Find((obj) => obj.sid == outTarget.sid); |
| | | if(delTemp!=null) |
| | |
| | | outputRow.RemoveFromParent(); |
| | | outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); |
| | | }; |
| | | outputTargetView.AddChidren(outputRow); |
| | | outputRow.SetDelClickeEvent(eventHandler); |
| | | } |
| | | outputTargetView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | } |
| | | outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); |
| | | outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count + 50); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | Button btnSubTitle; |
| | | |
| | | public InputRow(string title, string subtitle,string state) |
| | | Button btnDel; |
| | | |
| | | Button btnBypass; |
| | | |
| | | SecurityInput input; |
| | | |
| | | public InputRow(SecurityInput input) |
| | | { |
| | | this.LineColor = 0x00000000; |
| | | this.Height = Application.GetRealHeight(65); |
| | | this.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | this.input = input; |
| | | } |
| | | |
| | | public void InitView( )//(, , ); |
| | | { |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(320), |
| | | Text = title, |
| | | Text = input.GetFunction().name, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | |
| | | Y = Application.GetRealHeight(24), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(320), |
| | | Text = subtitle, |
| | | Text = input.GetFunction().GetRoomListName(), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | Text = state |
| | | Text = input.StateText() |
| | | }; |
| | | this.AddChidren(btnState); |
| | | |
| | | btnBypass = new Button() |
| | | { |
| | | BackgroundColor = CSS_Color.WarningColor, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextID = StringId.Bypass, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | this.AddRightView(btnBypass); |
| | | btnBypass.MouseUpEventHandler = (sender, e) => { |
| | | if (input.bypass == "true") |
| | | { |
| | | input.bypass = "false"; |
| | | btnBypass.BackgroundColor = CSS_Color.WarningColor; |
| | | btnBypass.TextID = StringId.Bypass; |
| | | } |
| | | else |
| | | { |
| | | input.bypass = "true"; |
| | | btnBypass.BackgroundColor = CSS_Color.MainColor; |
| | | btnBypass.TextID = StringId.Enable; |
| | | } |
| | | }; |
| | | if (input.bypass == "true") |
| | | { |
| | | btnBypass.BackgroundColor = CSS_Color.MainColor; |
| | | btnBypass.TextID = StringId.Enable; |
| | | } |
| | | |
| | | btnDel = new Button() |
| | | { |
| | | BackgroundColor = CSS_Color.TextualColor, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextID = StringId.Del, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | this.AddRightView(btnDel); |
| | | |
| | | } |
| | | |
| | |
| | | this.MouseUpEventHandler = eventHandler; |
| | | btnTitle.MouseUpEventHandler = eventHandler; |
| | | btnSubTitle.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | public void SetDelClickeEvent(EventHandler<MouseEventArgs> eventHandler) |
| | | { |
| | | btnDel.MouseUpEventHandler = eventHandler; |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | SecurityOutput output; |
| | | |
| | | public OutputRow(string title, string subtitle, SecurityOutput inOutput) |
| | | public OutputRow(SecurityOutput inOutput) |
| | | { |
| | | output = inOutput; |
| | | |
| | | this.LineColor = 0x00000000; |
| | | this.Height = Application.GetRealHeight(65); |
| | | this.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | } |
| | | |
| | | public void InitView(string title, string subtitle ) |
| | | { |
| | | |
| | | btnTitle = new Button() |
| | | { |
| | |
| | | { |
| | | BackgroundColor = CSS_Color.WarningColor, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextID = StringId.Del, |
| | | }; |
| | | this.AddRightView(btnDel); |
| | | |
| | | } |
| | | |
| | | public void SetDelClick(EventHandler<MouseEventArgs> eventHandler) |
| | | { |
| | | btnDel.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | |
| | | public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) |
| | | { |
| | | btnState.MouseUpEventHandler = eventHandler; |
| | |
| | | btnSubTitle.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | |
| | | public void SetDelClickeEvent(EventHandler<MouseEventArgs> eventHandler) |
| | | { |
| | | btnDel.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | |
| | | private void ShowStateDialog() |