| | |
| | | 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) |
| | | { |
| | | bodyView = this; |
| | |
| | | refreshAction = action; |
| | | } |
| | | |
| | | public void LoadPage() |
| | | public void LoadPage(string title = "") |
| | | { |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.Setting)).LoadTopView(); |
| | | |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | |
| | | contentView = new VerticalScrolViewLayout() |
| | |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | | #region 布防信息 |
| | | var deploymentTitleRow = new FrameLayout() |
| | | if (string.IsNullOrEmpty(title)) |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | | new TopViewDiv(bodyView, Language.StringByID(StringId.AddSecurity)).LoadTopView(); |
| | | #region 布防信息 |
| | | var deploymentTitleRow = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(deploymentTitleRow); |
| | | |
| | | var btnDeploymentTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.DeploymentInformation, |
| | | IsBold = true, |
| | | }; |
| | | deploymentTitleRow.AddChidren(btnDeploymentTitle); |
| | | |
| | | deploymentTitleRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | #region 布防名称 |
| | | var deploymentNameRow = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(deploymentNameRow); |
| | | |
| | | var btnDeploymentNameTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(72), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.Name, |
| | | }; |
| | | deploymentNameRow.AddChidren(btnDeploymentNameTitle); |
| | | btnDeploymentNameTitle.Text += ":"; |
| | | |
| | | var btnDeploymentName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(88), |
| | | Width = Application.GetRealWidth(230), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = securityAlarm.name |
| | | }; |
| | | deploymentNameRow.AddChidren(btnDeploymentName); |
| | | deploymentNameRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | LoadEvent_EditSecurityAlarmName(btnDeploymentName); |
| | | #endregion |
| | | |
| | | #region 触发延时 |
| | | var delayedRow = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.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.TriggerDelay, |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedTitle); |
| | | btnDelayedTitle.Text += ":"; |
| | | |
| | | var btnDelayedText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(88), |
| | | Width = Application.GetRealWidth(330), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = securityAlarm.delay + "s" |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedText); |
| | | btnDelayedText.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | Action<string> action = (obj) => |
| | | { |
| | | securityAlarm.delay = obj; |
| | | btnDelayedText.Text = securityAlarm.delay + "s"; |
| | | }; |
| | | new PublicAssmebly().SetSceneDelayDialog(action, securityAlarm.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 |
| | | |
| | | #endregion |
| | | |
| | | contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); |
| | | } |
| | | else |
| | | { |
| | | new TopViewDiv(bodyView, title).LoadTopView(); |
| | | } |
| | | |
| | | //布防功能 |
| | | iniDefenseView(); |
| | | |
| | | //告警目标 |
| | | iniAlarmView(); |
| | | |
| | | #region 执行推送 |
| | | ///上下间隔12像素 |
| | | contentView.AddChidren(new FrameLayout { Height = Application.GetRealHeight(12) }); |
| | | ///执行推送iew |
| | | FrameLayout pushView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(deploymentTitleRow); |
| | | contentView.AddChidren(pushView); |
| | | |
| | | var btnDeploymentTitle = new Button() |
| | | |
| | | var btnPushTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | TextColor = CSS_Color.MainColor, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextID = StringId.DeploymentInformation, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.push, |
| | | IsBold = true, |
| | | }; |
| | | deploymentTitleRow.AddChidren(btnDeploymentTitle); |
| | | pushView.AddChidren(btnPushTitle); |
| | | |
| | | deploymentTitleRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | #region 布防名称 |
| | | var deploymentNameRow = new FrameLayout() |
| | | var btnSwitchPush = new Button() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Width = Application.GetRealWidth(36), |
| | | Height = Application.GetRealWidth(36), |
| | | X = Application.GetRealWidth(323), |
| | | UnSelectedImagePath = "LogicIcon/off.png", |
| | | SelectedImagePath = "LogicIcon/on.png", |
| | | Gravity = Gravity.CenterVertical, |
| | | }; |
| | | contentView.AddChidren(deploymentNameRow); |
| | | pushView.AddChidren(btnSwitchPush); |
| | | |
| | | var btnDeploymentNameTitle = new Button() |
| | | |
| | | ///是否要推送点击事件 |
| | | btnSwitchPush.MouseUpEventHandler += (sender, e) => |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(72), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.Name, |
| | | //账号列表为空默认推送当前账号 |
| | | if (securityAlarm.pushConfigs.Count == 0) |
| | | { |
| | | //初始化对象 |
| | | var pushConfigs = new SecurityPushConfig(); |
| | | //默认添加推送当前账号 |
| | | pushConfigs.pushTarget.Add(UserInfo.Current.ID); |
| | | securityAlarm.pushConfigs.Add(pushConfigs); |
| | | } |
| | | btnSwitchPush.IsSelected = !btnSwitchPush.IsSelected; |
| | | if (btnSwitchPush.IsSelected) |
| | | { |
| | | securityAlarm.noticeConfig.enable = true; |
| | | } |
| | | else |
| | | { |
| | | securityAlarm.noticeConfig.enable = false; |
| | | } |
| | | }; |
| | | deploymentNameRow.AddChidren(btnDeploymentNameTitle); |
| | | btnDeploymentNameTitle.Text += ":"; |
| | | |
| | | var btnDeploymentName = new Button() |
| | | { |
| | | X = Application.GetRealWidth(88), |
| | | Width = Application.GetRealWidth(230), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = securityAlarm.name |
| | | }; |
| | | deploymentNameRow.AddChidren(btnDeploymentName); |
| | | deploymentNameRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | LoadEvent_EditSecurityAlarmName(btnDeploymentName); |
| | | pushView.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | #endregion |
| | | |
| | | /* |
| | | #region 触发延时 |
| | | var delayedRow = new FrameLayout() |
| | | #region 发送通知 |
| | | ///发送通知View |
| | | var pushMsgView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(50), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.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.TriggerDelay, |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedTitle); |
| | | btnDelayedTitle.Text += ":"; |
| | | |
| | | var btnDelayedText = new Button() |
| | | { |
| | | X = Application.GetRealWidth(88), |
| | | Width = Application.GetRealWidth(230), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.TextualColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | Text = securityAlarm.name |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedText); |
| | | |
| | | var btnDelayedRight = new Button() |
| | | contentView.AddChidren(pushMsgView); |
| | | var btnPushMsgRight = new Button() |
| | | { |
| | | X = Application.GetRealWidth(343), |
| | | Gravity = Gravity.CenterVertical, |
| | |
| | | Height = Application.GetMinRealAverage(16), |
| | | UnSelectedImagePath = "Public/RightIcon.png", |
| | | }; |
| | | delayedRow.AddChidren(btnDelayedRight); |
| | | pushMsgView.AddChidren(btnPushMsgRight); |
| | | |
| | | //delayedRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(49), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | #endregion |
| | | */ |
| | | |
| | | |
| | | var btnPushMsgTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Width = Application.GetRealWidth(372), |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextID = StringId.fasongtongzhi, |
| | | IsBold = true, |
| | | }; |
| | | pushMsgView.AddChidren(btnPushMsgTitle); |
| | | |
| | | btnPushMsgTitle.MouseUpEventHandler = (sender, e) => { |
| | | var inputPushText = new PushConfigPage(); |
| | | MainPage.BasePageView.AddChidren(inputPushText); |
| | | inputPushText.Show(securityAlarm); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | ///上下间隔62像素 |
| | | contentView.AddChidren(new FrameLayout { Height = Application.GetRealHeight(40) }); |
| | | |
| | | |
| | | #endregion |
| | | contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); |
| | | |
| | | //布防功能 |
| | | iniDefenseView(); |
| | | |
| | | #if DEBUG |
| | | //告警目标 |
| | | iniAlarmView(); |
| | | #endif |
| | | |
| | | |
| | | #region 底部区域 |
| | | var bottomView = new FrameLayout() |
| | |
| | | tip.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | //if (securityAlarm.output.Count == 0) |
| | | //{ |
| | | // var tip = new Tip() |
| | | // { |
| | | // Text = "请选择告警目标", |
| | | // 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(); |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | var code = securityAlarm.SaveInfo(); |
| | | if (code == StateCode.SUCCESS) |
| | | { |
| | |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(deploymentFunctionRow); |
| | | deploymentFunctionRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | |
| | | var btnFunctionTitle = new Button() |
| | | { |
| | |
| | | { |
| | | 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 }); |
| | | } |
| | | inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count); |
| | | //if (outputTargetView != null) |
| | | //{ |
| | | // contentView.AddChidren(outputTargetView); |
| | | //} |
| | | } |
| | | else |
| | | { |
| | |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | contentView.AddChidren(outputRow); |
| | | outputRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var btnOutputRowTitle = new Button() |
| | | { |
| | |
| | | outputTargetView = new VerticalScrolViewLayout() |
| | | { |
| | | ScrollEnabled = false, |
| | | Height =0, |
| | | }; |
| | | contentView.AddChidren(outputTargetView); |
| | | |
| | | outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); |
| | | iniAlarmListView(); |
| | | |
| | | #endregion |
| | |
| | | { |
| | | foreach (var outTarget in securityAlarm.output) |
| | | { |
| | | outputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(), "打开")); |
| | | if (outTarget.GetFunction() != null) |
| | | { |
| | | outputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(), outTarget.StateText())); |
| | | } |
| | | 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); |
| | | } |
| | |
| | | IsMoreLines = true, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }); |
| | | outputTargetView.Height = Application.GetRealHeight(68); |
| | | } |
| | | } |
| | | |
| | |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | |
| | | |
| | | btnDeploymentName.Text = securityAlarm.name = str; |
| | | |