| | |
| | | using System; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | | using Shared; |
| | |
| | | /// <summary> |
| | | /// 主窗体 |
| | | /// </summary> |
| | | FrameLayout bodyView; |
| | | public static ArmCenterPage bodyView; |
| | | /// <summary> |
| | | /// 自定义布防区域 |
| | | /// </summary> |
| | | HorizontalScrolViewLayout customDeploymentView; |
| | | /// <summary> |
| | | /// |
| | | /// </summary> |
| | | FrameLayout alarmIconBgView; |
| | | //安防状态背景图 |
| | | Button btnArmTipIcon; |
| | | /// <summary> |
| | | /// 安防警报图标 |
| | | /// </summary> |
| | | Button btnInalarmIcon; |
| | | /// <summary> |
| | | /// 当前布防名称 |
| | | /// </summary> |
| | | Button btnDefenseName; |
| | | |
| | | /// <summary> |
| | | /// 撤防区域 |
| | | /// </summary> |
| | | FrameLayout disarmView; |
| | | |
| | | public ArmCenterPage() |
| | | { |
| | | bodyView = this; |
| | |
| | | Height =Application.GetRealWidth(32), |
| | | }); |
| | | |
| | | //安防状态背景图 |
| | | Button btnArmTipIcon = new Button() |
| | | alarmIconBgView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Width = Application.GetRealWidth(198), |
| | | Height = Application.GetRealWidth(198), |
| | | }; |
| | | contentView.AddChidren(alarmIconBgView); |
| | | |
| | | btnArmTipIcon = new Button() |
| | | { |
| | | //Gravity = Gravity.CenterHorizontal, |
| | | //Width = Application.GetRealWidth(198), |
| | | //Height = Application.GetRealWidth(198), |
| | | UnSelectedImagePath = "FunctionIcon/ArmCenter/NoDefenseBigIcon.png", |
| | | SelectedImagePath = "FunctionIcon/ArmCenter/InDefenseBigIcon.png", |
| | | }; |
| | | contentView.AddChidren(btnArmTipIcon); |
| | | alarmIconBgView.AddChidren(btnArmTipIcon); |
| | | |
| | | btnInalarmIcon = new Button() |
| | | { |
| | | Width = Application.GetRealWidth(198), |
| | | Height = Application.GetRealWidth(198), |
| | | }; |
| | | btnInalarmIcon.MouseUpEventHandler = (sender, e) => { |
| | | if(SecurityCenter.Ins.InDefenseMode!= null) |
| | | { |
| | | SecurityCenter.Ins.InDefenseMode.alarm = false; |
| | | Control.Ins.ControlSecurity(SecurityCenter.Ins.InDefenseMode, "enable"); |
| | | } |
| | | }; |
| | | InitAlarmStatus(SecurityCenter.Ins.InAlarm); |
| | | |
| | | |
| | | btnDefenseName = new Button() |
| | | { |
| | | Y = Application.GetRealWidth(117), |
| | | Height = Application.GetRealHeight(81), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | }; |
| | | alarmIconBgView.AddChidren(btnDefenseName); |
| | | |
| | | contentView.AddChidren(new Button() |
| | | { |
| | | Height = Application.GetRealWidth(16), |
| | | }); |
| | | |
| | | #region 自定义布防 |
| | | //自定义布防标题 |
| | | Button btnCustomDeploymentTitle = new Button() |
| | | |
| | | #region 撤防区域 |
| | | Button btnDisarm; |
| | | disarmView = new FrameLayout() |
| | | { |
| | | Height = 0, |
| | | }; |
| | | contentView.AddChidren(disarmView); |
| | | |
| | | btnDisarm = new Button() |
| | | { |
| | | Y = Application.GetRealHeight(10), |
| | | Width = Application.GetRealWidth(148), |
| | | Height = Application.GetRealHeight(40), |
| | | BackgroundColor = CSS_Color.MainColor, |
| | | TextAlignment = TextAlignment.Center, |
| | | TextColor = CSS_Color.MainBackgroundColor, |
| | | Text = "撤防", |
| | | Radius = (uint)Application.GetRealWidth(20), |
| | | Gravity = Gravity.CenterHorizontal, |
| | | }; |
| | | disarmView.AddChidren(btnDisarm); |
| | | btnDisarm.MouseUpEventHandler = (sender, e) => { |
| | | //foreach (var temp in FunctionList.List.securities) |
| | | //{ |
| | | // if (temp.status == "enable") |
| | | // { |
| | | // Control.Ins.ControlSecurity(temp, "disable"); |
| | | // break; |
| | | // } |
| | | //} |
| | | if(SecurityCenter.Ins.InDefenseMode!= null) |
| | | { |
| | | Control.Ins.ControlSecurity(SecurityCenter.Ins.InDefenseMode, "disable"); |
| | | } |
| | | }; |
| | | |
| | | #endregion |
| | | |
| | | #region 自定义布防 |
| | | //自定义布防标题 |
| | | Button btnCustomDeploymentTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(54), |
| | |
| | | }; |
| | | contentView.AddChidren(btnCustomDeploymentTitle); |
| | | |
| | | HorizontalScrolViewLayout customDeploymentView = new HorizontalScrolViewLayout() |
| | | customDeploymentView = new HorizontalScrolViewLayout() |
| | | { |
| | | X = Application.GetRealWidth(23), |
| | | Height = Application.GetRealWidth(80), |
| | |
| | | }; |
| | | contentView.AddChidren(customDeploymentView); |
| | | |
| | | //customDeploymentView.AddChidren(new Button() |
| | | //{ |
| | | // Width = Application.GetRealWidth(23), |
| | | //}); |
| | | var view = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png", |
| | | Language.StringByID(StringId.HouseDefense)); |
| | | customDeploymentView.AddChidren(view); |
| | | EventHandler<MouseEventArgs> event1 = (sender, e) => |
| | | { |
| | | ShowArmDialog(new SecurityAlarm()); |
| | | }; |
| | | view.SetClickEvent(event1); |
| | | |
| | | |
| | | if(FunctionList.List.securities.Count>3) |
| | | { |
| | | customDeploymentView.ScrollEnabled = true; |
| | | } |
| | | |
| | | foreach (var mode in FunctionList.List.securities) |
| | | { |
| | | } |
| | | #endregion |
| | | |
| | | contentView.AddChidren(new Button() |
| | |
| | | Height = Application.GetRealHeight(20), |
| | | }); |
| | | |
| | | #region 固定布防区域 |
| | | /* |
| | | var fixedDeploymentView = new FrameLayout() |
| | | { |
| | | Height = Application.GetRealHeight(133), |
| | |
| | | }; |
| | | fixedDeploymentView.AddChidren(btnFixedDeploymentTip); |
| | | |
| | | //固定布防区域 |
| | | var fixedDeploymentTypeView = new HorizontalScrolViewLayout() |
| | | { |
| | | Y = btnFixedDeploymentTip.Bottom + Application.GetRealHeight(15), |
| | |
| | | Width = Application.GetRealWidth(24), |
| | | }); |
| | | |
| | | |
| | | #endregion |
| | | |
| | | |
| | | //灾害报警 |
| | |
| | | //防盗报警 |
| | | var burglarAlarmView = new FixedArmView("FunctionIcon/ArmCenter/BurglarAlarmIcon.png", Language.StringByID(StringId.BurglarAlarm), Language.StringByID(StringId.AlarmMute)); |
| | | fixedDeploymentTypeView.AddChidren(burglarAlarmView); |
| | | */ |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | ///刷新界面 |
| | | LoadEvent_RefreshSecurityStatus(); |
| | | |
| | | } |
| | | |
| | | public void InitAlarmStatus(bool inAlarm) |
| | | { |
| | | try |
| | | { |
| | | if (inAlarm) |
| | | { |
| | | alarmIconBgView.AddChidren(btnInalarmIcon); |
| | | } |
| | | else |
| | | { |
| | | btnInalarmIcon.RemoveFromParent(); |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化自定义布防区域 |
| | | /// </summary> |
| | | private void iniCustomDeploymentView() |
| | | { |
| | | customDeploymentView.RemoveAll(); |
| | | |
| | | foreach (var mode in FunctionList.List.securities) |
| | | { |
| | | var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png", |
| | | mode.name); |
| | | customDeploymentView.AddChidren(armDiyView); |
| | | EventHandler<MouseEventArgs> event2 = (sender, e) => |
| | | { |
| | | ShowArmDialog(mode); |
| | | }; |
| | | armDiyView.SetClickEvent(event2); |
| | | if (mode.status == "enable") |
| | | { |
| | | armDiyView.LightingView(true); |
| | | } |
| | | } |
| | | |
| | | 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.Show(); |
| | | |
| | | if(alarm.status == "enable") |
| | | { |
| | | btnOpen.TextColor = CSS_Color.PromptingColor1; |
| | | btnOpen.Text = Language.StringByID(StringId.AlreadyOpened).Trim() ; |
| | | } |
| | | |
| | | btnOpen.MouseUpEventHandler = (sender, e) => { |
| | | if (alarm.status == "disable") |
| | | { |
| | | Control.Ins.ControlSecurity(alarm, "enable"); |
| | | }else |
| | | { |
| | | Control.Ins.ControlSecurity(alarm, "disable"); |
| | | } |
| | | dialog.Close(); |
| | | }; |
| | | |
| | | |
| | | btnCheckModify.MouseUpEventHandler = (sender, e) => { |
| | | dialog.Close(); |
| | | var armSetPage = new ArmDeploymentSettingPage(alarm); |
| | | Action refreshAction = () => |
| | | { |
| | | iniCustomDeploymentView(); |
| | | }; |
| | | var armSetPage = new AddAlarmDeploymentPage(alarm,refreshAction); |
| | | MainPage.BasePageView.AddChidren(armSetPage); |
| | | armSetPage.LoadPage(); |
| | | MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1; |
| | |
| | | |
| | | } |
| | | |
| | | public static void LoadEvent_RefreshSecurityStatus() |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (bodyView != null) |
| | | { |
| | | bodyView.iniCustomDeploymentView(); |
| | | bodyView.disarmView.Height = 0; |
| | | bodyView.btnArmTipIcon.IsSelected = false; |
| | | bodyView.btnDefenseName.Text = ""; |
| | | foreach (var temp in FunctionList.List.securities) |
| | | { |
| | | if (temp.status == "enable") |
| | | { |
| | | bodyView.disarmView.Height = Application.GetRealHeight(68); |
| | | bodyView.btnArmTipIcon.IsSelected = true; |
| | | bodyView.btnDefenseName.Text = temp.name; |
| | | |
| | | bodyView.InitAlarmStatus(temp.alarm); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | |
| | | |
| | |
| | | btnText.MouseUpEventHandler = eventHandler; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 点亮区域 |
| | | /// </summary> |
| | | public void LightingView(bool seleted) |
| | | { |
| | | btnIcon.IsSelected = seleted; |
| | | } |
| | | |
| | | |
| | | } |
| | | |