| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using HDL_ON.DriverLayer; |
| | | using HDL_ON.Entity; |
| | | using HDL_ON.UI.CSS; |
| | |
| | | /// 撤防区域 |
| | | /// </summary> |
| | | FrameLayout disarmView; |
| | | |
| | | /// <summary> |
| | | /// 布防接口 |
| | | /// </summary> |
| | | SecurityAlarm InDefenseMode = null; |
| | | /// <summary> |
| | | /// 自定义布防控件列表 |
| | | /// </summary> |
| | | List<ArmDiyView> armDiyViewList = new List<ArmDiyView>(); |
| | | |
| | | public ArmCenterPage() |
| | | { |
| | |
| | | { |
| | | Width = Application.GetRealWidth(198), |
| | | Height = Application.GetRealWidth(198), |
| | | UnSelectedImagePath = "FunctionIcon/ArmCenter/InAlarmBigIcon.png", |
| | | }; |
| | | btnInalarmIcon.MouseUpEventHandler = (sender, e) => { |
| | | if(SecurityCenter.Ins.InDefenseMode!= null) |
| | | if(InDefenseMode!= null) |
| | | { |
| | | SecurityCenter.Ins.InDefenseMode.alarm = false; |
| | | Control.Ins.ControlSecurity(SecurityCenter.Ins.InDefenseMode, "enable"); |
| | | Action action = () => |
| | | { |
| | | InDefenseMode.alarm = false; |
| | | Control.Ins.ControlSecurity(InDefenseMode, "enable"); |
| | | }; |
| | | new PublicAssmebly().TipOptionMsg(StringId.Tip, StringId.DeleteSceneTip, action); |
| | | |
| | | } |
| | | }; |
| | | InitAlarmStatus(SecurityCenter.Ins.InAlarm); |
| | | |
| | | |
| | | btnDefenseName = new Button() |
| | | { |
| | |
| | | // break; |
| | | // } |
| | | //} |
| | | if(SecurityCenter.Ins.InDefenseMode!= null) |
| | | if(InDefenseMode!= null) |
| | | { |
| | | Control.Ins.ControlSecurity(SecurityCenter.Ins.InDefenseMode, "disable"); |
| | | Control.Ins.ControlSecurity(InDefenseMode, "disable"); |
| | | } |
| | | }; |
| | | |
| | | #endregion |
| | | #endregion |
| | | |
| | | #region 自定义布防 |
| | | //自定义布防标题 |
| | | Button btnCustomDeploymentTitle = new Button() |
| | | #region 自定义布防 |
| | | //自定义布防标题 |
| | | Button btnCustomDeploymentTitle = new Button() |
| | | { |
| | | X = Application.GetRealWidth(24), |
| | | Height = Application.GetRealWidth(54), |
| | |
| | | #endregion |
| | | |
| | | |
| | | |
| | | |
| | | ///刷新界面 |
| | | LoadEvent_RefreshSecurityStatus(); |
| | | iniCustomDeploymentView(); |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 初始化报警状态 |
| | | /// </summary> |
| | | /// <param name="inAlarm"></param> |
| | | public void InitAlarmStatus(bool inAlarm) |
| | | { |
| | | try |
| | | { |
| | | if (inAlarm) |
| | | { |
| | | alarmIconBgView.AddChidren(btnInalarmIcon); |
| | | if (btnInalarmIcon.Parent == null) |
| | | { |
| | | alarmIconBgView.AddChidren(btnInalarmIcon); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | btnInalarmIcon.RemoveFromParent(); |
| | | if (btnInalarmIcon.Parent != null) |
| | | { |
| | | btnInalarmIcon.RemoveFromParent(); |
| | | } |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | private void iniCustomDeploymentView() |
| | | { |
| | | customDeploymentView.RemoveAll(); |
| | | |
| | | armDiyViewList.Clear(); |
| | | foreach (var mode in FunctionList.List.securities) |
| | | { |
| | | var armDiyView = new ArmDiyView("FunctionIcon/ArmCenter/AtHomeDefenseIcon.png", "FunctionIcon/ArmCenter/AtHomeDefenseIconOn.png", |
| | | mode.name); |
| | | mode.name,mode.sid); |
| | | customDeploymentView.AddChidren(armDiyView); |
| | | EventHandler<MouseEventArgs> event2 = (sender, e) => |
| | | { |
| | |
| | | if (mode.status == "enable") |
| | | { |
| | | armDiyView.LightingView(true); |
| | | InDefenseMode = mode; |
| | | |
| | | ///刷新界面 |
| | | LoadEvent_RefreshSecurityStatus(InDefenseMode); |
| | | } |
| | | armDiyViewList.Add(armDiyView); |
| | | } |
| | | |
| | | if (FunctionList.List.securities.Count < 4) |
| | | { |
| | | var view = new ArmDiyView("FunctionIcon/ArmCenter/AddDefenseIcon.png", "FunctionIcon/ArmCenter/AddDefenseIcon.png", |
| | | Language.StringByID(StringId.Custom)); |
| | | Language.StringByID(StringId.Custom),"customSid"); |
| | | customDeploymentView.AddChidren(view); |
| | | EventHandler<MouseEventArgs> event1 = (sender, e) => |
| | | { |
| | |
| | | } |
| | | |
| | | btnOpen.MouseUpEventHandler = (sender, e) => { |
| | | if (alarm.status == "disable") |
| | | string controlStatus = alarm.status == "disable" ? "enable" : "disable"; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Control.Ins.ControlSecurity(alarm, "enable"); |
| | | }else |
| | | { |
| | | Control.Ins.ControlSecurity(alarm, "disable"); |
| | | } |
| | | Control.Ins.ControlSecurity(alarm, controlStatus); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | dialog.Close(); |
| | | }; |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | public static void LoadEvent_RefreshSecurityStatus() |
| | | public static void LoadEvent_RefreshSecurityStatus(SecurityAlarm updataTemp) |
| | | { |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | if (bodyView != null) |
| | | try |
| | | { |
| | | bodyView.iniCustomDeploymentView(); |
| | | bodyView.disarmView.Height = 0; |
| | | bodyView.btnArmTipIcon.IsSelected = false; |
| | | bodyView.btnDefenseName.Text = ""; |
| | | foreach (var temp in FunctionList.List.securities) |
| | | if (bodyView != null) |
| | | { |
| | | if (temp.status == "enable") |
| | | //布防 |
| | | if (updataTemp.status == "enable") |
| | | { |
| | | bodyView.disarmView.Height = Application.GetRealHeight(68); |
| | | bodyView.btnArmTipIcon.IsSelected = true; |
| | | bodyView.btnDefenseName.Text = temp.name; |
| | | |
| | | bodyView.InitAlarmStatus(temp.alarm); |
| | | break; |
| | | bodyView.InDefenseMode = updataTemp; |
| | | foreach (var tempView in bodyView.armDiyViewList) |
| | | { |
| | | tempView.LightingView(false); |
| | | if (tempView.sid == updataTemp.sid) |
| | | { |
| | | tempView.LightingView(updataTemp.status == "enable"); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //撤防 |
| | | if(bodyView.InDefenseMode.sid == updataTemp.sid) |
| | | { |
| | | foreach (var tempView in bodyView.armDiyViewList) |
| | | { |
| | | tempView.LightingView(false); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | //foreach(var tempView in bodyView.armDiyViewList) |
| | | //{ |
| | | // tempView.LightingView(false); |
| | | // if(tempView.sid == updataTemp.sid) |
| | | // { |
| | | // tempView.LightingView(updataTemp.status == "enable"); |
| | | // } |
| | | //} |
| | | |
| | | //没有布防的情况 |
| | | if (bodyView.InDefenseMode ==null|| bodyView.InDefenseMode.status == "disable") |
| | | { |
| | | bodyView.disarmView.Height = 0; |
| | | bodyView.btnArmTipIcon.IsSelected = false; |
| | | bodyView.btnDefenseName.Text = ""; |
| | | } |
| | | else |
| | | { |
| | | bodyView.disarmView.Height = Application.GetRealHeight(68); |
| | | bodyView.btnArmTipIcon.IsSelected = true; |
| | | bodyView.btnDefenseName.Text = bodyView.InDefenseMode.name; |
| | | } |
| | | bodyView.InitAlarmStatus(bodyView.InDefenseMode.alarm); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | MainPage.Log($"安防界面更新异常:{ex.Message}"); |
| | | } |
| | | }); |
| | | } |
| | |
| | | { |
| | | Button btnIcon; |
| | | Button btnText; |
| | | public string sid; |
| | | /// <summary> |
| | | /// 自定义布防界面 |
| | | /// </summary> |
| | | /// <param name="UnSelectedIconPath">图片路径</param> |
| | | /// <param name="SelectedIconPath">图片路径</param> |
| | | /// <param name="Text">显示文本</param> |
| | | public ArmDiyView(string UnSelectedIconPath, string SelectedIconPath, string Text) |
| | | public ArmDiyView(string UnSelectedIconPath, string SelectedIconPath, string Text,string inSid) |
| | | { |
| | | sid = inSid; |
| | | this.Width = Application.GetRealWidth(82); |
| | | this.Height = Application.GetRealWidth(80); |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 固定布防控件 |
| | | /// </summary> |
| | | public class FixedArmView : FrameLayout |
| | | { |
| | | /// <summary> |