| | |
| | | public class ArmDeploymentSettingPage : FrameLayout |
| | | { |
| | | FrameLayout bodyView; |
| | | SecurityAlarm securityAlarm; |
| | | /// <summary> |
| | | /// 主题界面 |
| | | /// </summary> |
| | | VerticalScrolViewLayout contentView; |
| | | /// <summary> |
| | | /// 输入条件列表区域界面 |
| | | /// </summary> |
| | | VerticalScrolViewLayout inputTargetView; |
| | | /// <summary> |
| | | /// 告警目标列表区域界面 |
| | | /// </summary> |
| | | VerticalScrolViewLayout outputTargetView; |
| | | |
| | | public ArmDeploymentSettingPage(SecurityAlarm alarm ) |
| | | |
| | | SecurityAlarm securityAlarm; |
| | | Action refreshAction; |
| | | |
| | | public ArmDeploymentSettingPage(SecurityAlarm alarm, Action action) |
| | | { |
| | | bodyView = this; |
| | | securityAlarm = alarm; |
| | | refreshAction = action; |
| | | } |
| | | |
| | | public void LoadPage() |
| | |
| | | |
| | | bodyView.BackgroundColor = CSS_Color.BackgroundColor; |
| | | |
| | | VerticalScrolViewLayout contentView = new VerticalScrolViewLayout() |
| | | contentView = new VerticalScrolViewLayout() |
| | | { |
| | | Y = Application.GetRealHeight(64), |
| | | Height = Application.GetRealHeight(667 - 64), |
| | | Height = Application.GetRealHeight(527), |
| | | }; |
| | | bodyView.AddChidren(contentView); |
| | | |
| | |
| | | LoadEvent_EditSecurityAlarmName(btnDeploymentName); |
| | | #endregion |
| | | |
| | | /* |
| | | #region 触发延时 |
| | | //var delayedRow = new FrameLayout() |
| | | //{ |
| | | // Height = Application.GetRealHeight(50), |
| | | // BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | //}; |
| | | //contentView.AddChidren(delayedRow); |
| | | 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.Name, |
| | | //}; |
| | | //delayedRow.AddChidren(btnDelayedTitle); |
| | | 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 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() |
| | | //{ |
| | | // X = Application.GetRealWidth(343), |
| | | // Gravity = Gravity.CenterVertical, |
| | | // Width = Application.GetMinRealAverage(16), |
| | | // Height = Application.GetMinRealAverage(16), |
| | | // UnSelectedImagePath = "Public/RightIcon.png", |
| | | //}; |
| | | //delayedRow.AddChidren(btnDelayedRight); |
| | | 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 }); |
| | | //LoadEvent_EditSecurityAlarmName(btnDelayedTitle); |
| | | //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 }); |
| | | |
| | | #region 布防功能\报警状态 |
| | | //布防功能 |
| | | iniDefenseView(); |
| | | //告警目标 |
| | | iniAlarmView(); |
| | | |
| | | #region 底部区域 |
| | | var bottomView = new FrameLayout() |
| | | { |
| | | Y = Application.GetRealHeight(591), |
| | | Height = Application.GetRealHeight(100), |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | Radius = (uint)Application.GetRealWidth(22), |
| | | }; |
| | | this.AddChidren(bottomView); |
| | | |
| | | var btnConfrim = new Button() |
| | | { |
| | | X = Application.GetRealWidth(78), |
| | | Y = Application.GetRealHeight(12), |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealWidth(44), |
| | | Radius = (uint)Application.GetRealWidth(22), |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextID = StringId.Confirm, |
| | | TextSize = CSS_FontSize.SubheadingFontSize, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | }; |
| | | bottomView.AddChidren(btnConfrim); |
| | | |
| | | btnConfrim.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | if (securityAlarm.input.Count == 0) |
| | | { |
| | | var tip = new Tip() |
| | | { |
| | | Text = "请选择布防目标", |
| | | CloseTime = 3, |
| | | Direction = AMPopTipDirection.None |
| | | }; |
| | | 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; |
| | | } |
| | | |
| | | var waitPage = new Loading(); |
| | | waitPage.Start(); |
| | | new System.Threading.Thread(() => |
| | | { |
| | | try |
| | | { |
| | | var code = securityAlarm.SaveInfo(); |
| | | if (code == StateCode.SUCCESS) |
| | | { |
| | | Common.ApiUtlis.Ins.GetSecurityList(); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | this.RemoveFromParent(); |
| | | refreshAction?.Invoke(); |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(code); |
| | | }); |
| | | } |
| | | } |
| | | catch { } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => { |
| | | waitPage.Hide(); |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | }; |
| | | #endregion |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化部分功能区域 |
| | | /// </summary> |
| | | private void iniDefenseView() |
| | | { |
| | | |
| | | #region 布防功能 |
| | | var deploymentFunctionRow = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(44), |
| | |
| | | UnSelectedImagePath = "FunctionIcon/ArmCenter/AddTargetIcon.png", |
| | | }; |
| | | deploymentFunctionRow.AddChidren(btnAddTarget); |
| | | ///添加输入目标 |
| | | btnAddTarget.MouseUpEventHandler = (sender, e) => { |
| | | Action<SecurityAlarm> action = (outTemp) => { |
| | | securityAlarm = outTemp; |
| | | iniInputTargetView(); |
| | | }; |
| | | var page = new AddInputPage(securityAlarm, action); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | deploymentFunctionRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | var inputTargetView = new VerticalScrolViewLayout() |
| | | inputTargetView = new VerticalScrolViewLayout() |
| | | { |
| | | ScrollEnabled = false, |
| | | }; |
| | | contentView.AddChidren(inputTargetView); |
| | | foreach (var target in securityAlarm.input) |
| | | { |
| | | inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName())); |
| | | } |
| | | inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count); |
| | | |
| | | iniInputTargetView(); |
| | | |
| | | #endregion |
| | | contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化输入条件区域界面 |
| | | /// </summary> |
| | | /// <param name=""></param> |
| | | private void iniInputTargetView() |
| | | { |
| | | inputTargetView.RemoveAll(); |
| | | if (securityAlarm.input.Count > 0) |
| | | { |
| | | foreach (var target in securityAlarm.input) |
| | | { |
| | | inputTargetView.AddChidren(new InputRow(target.GetFunction().name, target.GetFunction().GetRoomListName(), target.StateText())); |
| | | } |
| | | inputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.input.Count); |
| | | //if (outputTargetView != null) |
| | | //{ |
| | | // contentView.AddChidren(outputTargetView); |
| | | //} |
| | | } |
| | | else |
| | | { |
| | | inputTargetView.AddChidren(new Button() |
| | | { |
| | | Height = Application.GetRealHeight(65), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextID = StringId.ThereIsNoAssociatedTaskDeploymentStatus, |
| | | IsMoreLines = true, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }); |
| | | |
| | | inputTargetView.Height = Application.GetRealHeight(68); |
| | | //if(outputTargetView!= null) |
| | | //{ |
| | | // contentView.AddChidren(outputTargetView); |
| | | //} |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化告警目标区域 |
| | | /// </summary> |
| | | private void iniAlarmView() |
| | | { |
| | | #region 告警目标 |
| | | var outputRow = new FrameLayout() |
| | | { |
| | |
| | | UnSelectedImagePath = "FunctionIcon/ArmCenter/AddTargetIcon.png", |
| | | }; |
| | | outputRow.AddChidren(btnAddOutTarget); |
| | | |
| | | btnAddOutTarget.MouseUpEventHandler = (sender, e) => { |
| | | Action<SecurityAlarm> action = (outTemp) => { |
| | | securityAlarm = outTemp; |
| | | iniAlarmListView(); |
| | | }; |
| | | var page = new AddOutputPage(securityAlarm, action); |
| | | MainPage.BasePageView.AddChidren(page); |
| | | page.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | | }; |
| | | |
| | | outputRow.AddChidren(new Button() { Gravity = Gravity.CenterHorizontal, Y = Application.GetRealHeight(43), Height = 1, BackgroundColor = CSS_Color.DividingLineColor }); |
| | | |
| | | |
| | | var outputTargetView = new VerticalScrolViewLayout() |
| | | outputTargetView = new VerticalScrolViewLayout() |
| | | { |
| | | ScrollEnabled = false, |
| | | }; |
| | | contentView.AddChidren(outputTargetView); |
| | | foreach(var outTarget in securityAlarm.output) |
| | | { |
| | | inputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(),"")); |
| | | } |
| | | outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); |
| | | |
| | | iniAlarmListView(); |
| | | |
| | | #endregion |
| | | contentView.AddChidren(new Button() { Height = Application.GetRealHeight(8), BackgroundColor = CSS_Color.BackgroundColor }); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化告警列表区域 |
| | | /// </summary> |
| | | private void iniAlarmListView() |
| | | { |
| | | outputTargetView.RemoveAll(); |
| | | if (securityAlarm.output.Count > 0) |
| | | { |
| | | foreach (var outTarget in securityAlarm.output) |
| | | { |
| | | outputTargetView.AddChidren(new OutputRow(outTarget.GetFunction().name, outTarget.GetFunction().GetRoomListName(), "打开")); |
| | | } |
| | | outputTargetView.Height = Application.GetRealHeight(65 * securityAlarm.output.Count); |
| | | } |
| | | else |
| | | { |
| | | outputTargetView.AddChidren(new Button() |
| | | { |
| | | Height = Application.GetRealHeight(65), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextID = StringId.ThereIsNoAssociatedTaskDeploymentStatus, |
| | | IsMoreLines = true, |
| | | BackgroundColor = CSS_Color.MainBackgroundColor, |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 修改安防名称 |
| | |
| | | { |
| | | Action<string> callBack = (str) => |
| | | { |
| | | var waitPage = new Loading(); |
| | | bodyView.AddChidren(waitPage); |
| | | waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | new System.Threading.Thread(() => |
| | | //名称不能为空 |
| | | if (string.IsNullOrEmpty(str)) |
| | | { |
| | | try |
| | | new Tip() |
| | | { |
| | | securityAlarm.name = str; |
| | | var responsePack = new HttpServerRequest().EditSecurity(new List<SecurityAlarm>() { securityAlarm}); |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.NameCannotBeEmpty), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(bodyView); |
| | | return; |
| | | } |
| | | |
| | | if (responsePack.Code == StateCode.SUCCESS) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnDeploymentName.Text = str; |
| | | }); |
| | | } |
| | | else |
| | | { |
| | | IMessageCommon.Current.ShowErrorInfoAlter(responsePack.Code); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"update user name error : {ex.Message}"); |
| | | } |
| | | finally |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (waitPage != null) |
| | | { |
| | | waitPage.RemoveFromParent(); |
| | | waitPage = null; |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | |
| | | btnDeploymentName.Text = securityAlarm.name = str; |
| | | |
| | | //var waitPage = new Loading(); |
| | | //bodyView.AddChidren(waitPage); |
| | | //waitPage.Start(Language.StringByID(StringId.PleaseWait)); |
| | | //new System.Threading.Thread(() => |
| | | //{ |
| | | // try |
| | | // { |
| | | // securityAlarm.name = str; |
| | | // var responsePack = new HttpServerRequest().EditSecurity(new List<SecurityAlarm>() { securityAlarm}); |
| | | // if (responsePack.Code == StateCode.SUCCESS) |
| | | // { |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // btnDeploymentName.Text = str; |
| | | // }); |
| | | // } |
| | | // else |
| | | // { |
| | | // IMessageCommon.Current.ShowErrorInfoAlter(responsePack.Code); |
| | | // } |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log($"update user name error : {ex.Message}"); |
| | | // } |
| | | // finally |
| | | // { |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // if (waitPage != null) |
| | | // { |
| | | // waitPage.RemoveFromParent(); |
| | | // waitPage = null; |
| | | // } |
| | | // }); |
| | | // } |
| | | //}) |
| | | //{ IsBackground = true }.Start(); |
| | | }; |
| | | new PublicAssmebly().LoadDialog_EditParater(StringId.Name, securityAlarm.name, callBack, StringId.NameCannotBeEmpty, 0, new List<string>()); |
| | | }; |
| | | btnDeploymentName.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输入条件行控件 |
| | | /// </summary> |
| | | public class InputRow : RowLayout |
| | | { |
| | | Button btnTitle; |
| | | |
| | | Button btnSubTitle; |
| | | |
| | | public InputRow(string title,string subtitle) |
| | | { |
| | | this.LineColor = 0x00000000; |
| | | this.Height = Application.GetRealHeight(65); |
| | | this.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(320), |
| | | Text = title, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | this.AddChidren(btnTitle); |
| | | |
| | | btnSubTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealHeight(24), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(320), |
| | | Text = subtitle, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | this.AddChidren(btnSubTitle); |
| | | |
| | | } |
| | | |
| | | public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) |
| | | { |
| | | this.MouseUpEventHandler = eventHandler; |
| | | btnTitle.MouseUpEventHandler = eventHandler; |
| | | btnSubTitle.MouseUpEventHandler = eventHandler; |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输出条件控件 |
| | | /// </summary> |
| | | public class OutputRow : RowLayout |
| | | { |
| | | Button btnTitle; |
| | | |
| | | Button btnSubTitle; |
| | | |
| | | Button btnState; |
| | | |
| | | Button btnRightIcon; |
| | | |
| | | public OutputRow(string title, string subtitle,string state) |
| | | { |
| | | this.LineColor = 0x00000000; |
| | | this.Height = Application.GetRealHeight(65); |
| | | this.BackgroundColor = CSS_Color.MainBackgroundColor; |
| | | |
| | | btnTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(320), |
| | | Text = title, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.FirstLevelTitleColor, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | }; |
| | | this.AddChidren(btnTitle); |
| | | |
| | | btnSubTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(16), |
| | | Y = Application.GetRealHeight(24), |
| | | Height = Application.GetRealHeight(44), |
| | | Width = Application.GetRealWidth(320), |
| | | Text = subtitle, |
| | | TextAlignment = TextAlignment.CenterLeft, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | }; |
| | | this.AddChidren(btnSubTitle); |
| | | |
| | | btnState = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(323), |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | Text = state |
| | | }; |
| | | this.AddChidren(btnState); |
| | | |
| | | btnRightIcon = new Button() |
| | | { |
| | | X = Application.GetRealWidth(339), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(16), |
| | | Height = Application.GetRealWidth(16), |
| | | UnSelectedImagePath = "FunctionIcon/ArmCenter/RightIcon.png", |
| | | }; |
| | | this.AddChidren(btnRightIcon); |
| | | } |
| | | |
| | | public void SetClickEvent(EventHandler<MouseEventArgs> eventHandler) |
| | | { |
| | | btnState.MouseUpEventHandler = eventHandler; |
| | | btnTitle.MouseUpEventHandler = eventHandler; |
| | | btnSubTitle.MouseUpEventHandler = eventHandler; |
| | | } |
| | | } |
| | | } |