Ejemplo n.º 1
0
 void OnZoneStateChanged(ZoneState zoneState)
 {
     if (ZoneState == zoneState)
     {
         StateType = ZoneState.StateType;
     }
 }
Ejemplo n.º 2
0
 public ZoneViewModel(ZoneState zoneState)
 {
     ZoneState = zoneState;
     _stateType = zoneState.StateType;
     ItvManager.ZoneStateChanged += new Action<ZoneState>(OnZoneStateChanged);
     No = zoneState.Zone.No;
     Name = zoneState.Zone.Name;
 }
Ejemplo n.º 3
0
        public ZoneViewModel(ZoneState zoneState)
        {
            ZoneState = zoneState;
            _stateType = zoneState.StateType;
			ItvManager.ZoneStateChanged += new Action<ZoneState>((x) => { SafeCall(() => { OnZoneStateChanged(x); }); });
            No = zoneState.Zone.No;
            Name = zoneState.Zone.Name;
        }
Ejemplo n.º 4
0
 public ZoneViewModel(ZoneState zoneState)
 {
     ZoneState = zoneState;
     _stateType = zoneState.StateType;
     FiresecCallbackService.ZoneStateChangedEvent += new Action<int>(OnZoneStateChangedEvent);
     var zone = ItvManager.DeviceConfiguration.Zones.FirstOrDefault(x=>x.No == zoneState.No);
     if (zone != null)
     {
         Name = zone.PresentationName;
     }
 }
Ejemplo n.º 5
0
		public ZoneViewModel(ZoneState zoneState)
		{
			ShowOnPlanCommand = new RelayCommand(OnShowOnPlan, CanShowOnPlan);
			DisableAllCommand = new RelayCommand(OnDisableAll, CanDisableAll);
			EnableAllCommand = new RelayCommand(OnEnableAll, CanEnableAll);
			SetGuardCommand = new RelayCommand(OnSetGuard, CanSetGuard);
			UnSetGuardCommand = new RelayCommand(OnUnSetGuard, CanUnSetGuard);

			ZoneState = zoneState;
			ZoneState.StateChanged += new System.Action(OnStateChanged);
			OnStateChanged();
			InitializeDevices();
		}
Ejemplo n.º 6
0
        public static bool IsZoneOnGuard(ZoneState zoneState)
        {
            if (zoneState.Zone.ZoneType == ZoneType.Fire)
            {
                return false;
            }
            foreach (var device in zoneState.Zone.DevicesInZone)
            {
                if (device.Driver.DriverType != DriverType.AM1_O)
                    continue;

                var deviceState = FiresecManager.DeviceStates.DeviceStates.FirstOrDefault(x => x.UID == device.UID);
                if (deviceState.States.Count != 1)
                    return false;
                if (deviceState.States.First().Code != "OnGuard")
                    return false;
            }
            return true;
        }
Ejemplo n.º 7
0
        public ZoneViewModel(ZoneState zoneState)
        {
            SelectCommand = new RelayCommand(OnSelect);
            ShowOnPlanCommand = new RelayCommand(OnShowOnPlan, CanShowOnPlan);
            SetGuardCommand = new RelayCommand(OnSetGuard, CanSetGuard);
            UnSetGuardCommand = new RelayCommand(OnUnSetGuard, CanUnSetGuard);

            ZoneState = zoneState;
            if (FiresecManager.DeviceStates == null)
            {
                Logger.Error("ZoneViewModel.ctrl FiresecManager.DeviceStates = null");
                return;
            }
            if (FiresecManager.DeviceStates.ZoneStates == null)
            {
                Logger.Error("ZoneViewModel.ctrl FiresecManager.DeviceStates.ZoneStates = null");
                return;
            }
            ZoneState.StateChanged += new System.Action(OnStateChanged);
            OnStateChanged();
        }
Ejemplo n.º 8
0
        public static bool IsZoneOnGuardAlarm(ZoneState zoneState)
        {
            if (zoneState.Zone.ZoneType == ZoneType.Fire)
            {
                return false;
            }
            foreach (var device in zoneState.Zone.DevicesInZone)
            {
                if (device.Driver.DriverType != DriverType.AM1_O)
                    continue;

                var deviceState = FiresecManager.DeviceStates.DeviceStates.FirstOrDefault(x => x.UID == device.UID);
                foreach (var state in deviceState.States)
                {
                    if (state.Code.Contains("Alarm"))
                        return true;
                    if (state.Code == "InitFailed")
                        return true;
                }
            }
            return false;
        }
Ejemplo n.º 9
0
		public void CreateStates()
		{
			foreach (var device in DeviceConfiguration.Devices)
			{
				var deviceState = new DeviceState()
				{
					Device = device
				};
				foreach (var parameter in device.Driver.Parameters)
					deviceState.Parameters.Add(parameter.Copy());
				device.DeviceState = deviceState;
			}

			foreach (var zone in DeviceConfiguration.Zones)
			{
				var zoneState = new ZoneState()
				{
					Zone = zone,
				};
				zone.ZoneState = zoneState;
			}
		}
Ejemplo n.º 10
0
		public static bool IsZoneOnGuard(ZoneState zoneState)
		{
			try
			{
				if (zoneState.Zone.ZoneType == ZoneType.Fire)
				{
					return false;
				}
				foreach (var device in zoneState.Zone.DevicesInZone)
				{
					if (device.Driver.DriverType != DriverType.AM1_O)
						continue;

					if (device.DeviceState.ThreadSafeStates.Count == 1 && device.DeviceState.ThreadSafeStates.First().DriverState.Code == "OnGuard")
						return true;
				}
				return false;
			}
			catch (Exception e)
			{
				Logger.Error(e, "FiresecManager.IsZoneOnGuard");
				return false;
			}
		}
Ejemplo n.º 11
0
		public static bool IsZoneOnGuardAlarm(ZoneState zoneState)
		{
			try
			{
				if (zoneState.Zone.ZoneType == ZoneType.Fire)
				{
					return false;
				}
				foreach (var device in zoneState.Zone.DevicesInZone)
				{
					if (device.Driver.DriverType != DriverType.AM1_O)
						continue;

					foreach (var state in device.DeviceState.ThreadSafeStates)
					{
						if (state.DriverState.Code.Contains("Alarm") || state.DriverState.Code.Contains("InitFailed"))
							return true;
					}
				}
				return false;
			}
			catch (Exception e)
			{
				Logger.Error(e, "FiresecManager.IsZoneOnGuardAlarm");
				return false;
			}
		}