public static void SetZoneGuard(Zone zone) { try { //if (IsFS2Enabled) //{ // FS2ClientContract.SetZoneGuard(zone.UID, FiresecManager.CurrentUser.Name); //} //else { if ((zone.ZoneType == ZoneType.Guard) && (zone.SecPanelUID != Guid.Empty)) { var localNo = FiresecConfiguration.GetZoneLocalSecNo(zone); if (localNo > 0) { FiresecDriver.SetZoneGuard(zone.SecPanelUID, localNo); } } } } catch (Exception e) { Logger.Error(e, "FiresecManager.SetZoneGuard"); } }
void AddRemoteZoneToPanel(BinaryPanel binaryPanel, Zone zone) { if (!binaryPanel.RemoteZones.Contains(zone)) { var remoteBinaryPanels = new HashSet<Device>(); foreach (var zoneDevice in zone.DevicesInZone) { var remoteBinaryPanel = BinaryPanels.FirstOrDefault(x => x.ParentPanel == zoneDevice.ParentPanel); if (remoteBinaryPanel.ParentPanel.UID != binaryPanel.ParentPanel.UID) { remoteBinaryPanels.Add(remoteBinaryPanel.ParentPanel); } } foreach (var remoteBinaryPanel in remoteBinaryPanels) { var zoneBinaryPanel = BinaryPanels.FirstOrDefault(x => x.ParentPanel == remoteBinaryPanel); var binaryZone = new BinaryZone(zone) { IsRemote = true, ParentPanel = remoteBinaryPanel }; binaryZone.BinaryPanels.Add(binaryPanel); binaryZone.BinaryPanels.Add(zoneBinaryPanel); binaryPanel.RemoteZones.Add(zone); binaryPanel.BinaryRemoteZones.Add(binaryZone); } } }
public static List<Device> GetRemoteForZone(Device parentPanel, Zone zone) { var devices = new HashSet<Device>(); foreach (var device in GetDevicesInLogic(zone)) { foreach (var clause in device.ZoneLogic.Clauses) { var allZonesAreRemote = true; foreach (var clauseZone in clause.Zones) { if (clauseZone.DevicesInZone.FirstOrDefault().ParentPanel.UID == device.ParentPanel.UID) allZonesAreRemote = false; } if (clause.Operation.Value == ZoneLogicOperation.Any || allZonesAreRemote) { foreach (var clauseZone in clause.Zones) { if (clauseZone.UID == zone.UID) { if (device.ParentPanel.UID != parentPanel.UID) { devices.Add(device); } } } } } } return devices.ToList(); }
public ZoneViewModel(Zone zone) { SetGuardCommand = new RelayCommand(OnSetGuard, CanSetResetGuard); ResetGuardCommand = new RelayCommand(OnResetGuard, CanSetResetGuard); Zone = zone; Zone.ZoneState.StateChanged += new Action(ZoneState_StateChanged); }
public static List<DevicesOnShleif> GetLocalForZone(Device parentPanel, Zone zone) { var devicesOnShleifs = new List<DevicesOnShleif>(); for (int i = 1; i <= parentPanel.Driver.ShleifCount; i++) { var devicesOnShleif = new DevicesOnShleif() { ShleifNo = i }; devicesOnShleifs.Add(devicesOnShleif); } var effectorDevices = GetDevicesInLogic(zone); foreach (var device in effectorDevices.OrderBy(x => x.IntAddress)) { if (device.ParentPanel.UID == parentPanel.UID) { var shleifNo = device.ShleifNo; if (device.Driver.DriverType == DriverType.PumpStation) shleifNo = 1; var devicesOnShleif = devicesOnShleifs.FirstOrDefault(x => x.ShleifNo == shleifNo); if (devicesOnShleif != null) { devicesOnShleif.Devices.Add(device); } } } return devicesOnShleifs; }
public static void Add(string description, string userName, Device panelDevice = null, Device device = null, Zone zone = null, StateType stateType = StateType.Info) { var journalItem = new FS2JournalItem { DeviceTime = DateTime.Now, SystemTime = DateTime.Now, Description = description, UserName = userName, PanelDevice = panelDevice, Device = device, StateType = stateType, SubsystemType = SubsystemType.Other, }; if (panelDevice != null) { journalItem.PanelName = panelDevice.DottedPresentationNameAndAddress; journalItem.PanelUID = panelDevice.UID; } if (device != null) { journalItem.DeviceName = device.DottedPresentationNameAndAddress; journalItem.DeviceUID = device.UID; } if (zone != null) { journalItem.ZoneNo = zone.No; journalItem.ZoneName = zone.PresentationName; } AddJournalItem(journalItem); }
public ZoneDetailsViewModel(Zone zone = null) { ComboboxIsEnabled = true; if (zone == null) { Title = "Создание новой зоны"; Zone = new Zone() { Name = "Новая зона", No = 1, DetectorCount = LastDetectorCount }; if (FiresecManager.Zones.Count != 0) Zone.No = FiresecManager.Zones.Select(x => x.No).Max() + 1; if (Zone.No > 99999) Zone.No = 99999; } else { Title = string.Format("Свойства зоны: {0}", zone.PresentationName); Zone = zone; } CopyProperties(); AvailableNames = new ObservableCollection<string>(); AvailableDescription = new ObservableCollection<string>(); foreach (var existingZone in FiresecManager.Zones) { AvailableNames.Add(existingZone.Name); AvailableDescription.Add(existingZone.Description); } }
static void Notify(Zone zone, Email email) { string message = " Изменение состояния зоны " + zone.PresentationName + " на состояние " + zone.ZoneState.StateType.ToDescription(); MailHelper.Send(FiresecManager.SystemConfiguration.EmailData.EmailSettings, email.Address, message, email.MessageTitle); }
public void Update(Zone zone) { Zone = zone; OnPropertyChanged("Zone"); OnPropertyChanged("Name"); OnPropertyChanged("Description"); Update(); }
public static void SetZone(IElementZone element, Zone zone) { ResetZone(element); element.ZoneUID = zone == null ? Guid.Empty : zone.UID; element.BackgroundColor = GetZoneColor(zone); if (zone != null) zone.PlanElementUIDs.Add(element.UID); }
public static List<Device> GetZonePanels(Zone zone) { var devices = new HashSet<Device>(); foreach (var zoneDevice in zone.DevicesInZone) { devices.Add(zoneDevice.ParentPanel); } return devices.ToList(); }
public static int GetLocalZoneNo(Zone zone, Device panelDevice) { var zonePanelItem = ZonePanelItems.FirstOrDefault(x => x.Zone.UID == zone.UID && x.PanelDevice.UID == panelDevice.UID && x.IsRemote == false); if (zonePanelItem != null) { return zonePanelItem.No; } return 0; }
public static void UnSetZoneGuard(Zone zone) { if ((zone.ZoneType == ZoneType.Guard) && (zone.SecPanelUID != Guid.Empty)) { var localNo = FiresecConfiguration.GetZoneLocalSecNo(zone); if (localNo > 0) { FiresecService.UnSetZoneGuard(zone.SecPanelUID, localNo); } } }
public InstructionViewModel(Device device, Zone zone, AlarmType alarmType) { Title = "Инструкция "; AlarmType = alarmType; Instruction = FindInstruction(device, zone); HasContent = Instruction != null; if (Instruction != null) { Title += Instruction.Name; } }
void Add(Zone zone, Device panelDevice, bool isRemote) { if (!ZonePanelItems.Any(x => x.Zone.UID == zone.UID && x.PanelDevice.UID == panelDevice.UID && x.IsRemote == isRemote)) { var zonePanelItem = new ZonePanelItem() { Zone = zone, PanelDevice = panelDevice, IsRemote = isRemote }; ZonePanelItems.Add(zonePanelItem); } }
void ValidateZoneHasDifferentDevices(Zone zone) { if (zone.ZoneType == ZoneType.Guard) { var deviceUIDs = new HashSet<Guid>(); foreach (var device in zone.DevicesInZone) { deviceUIDs.Add(device.ParentPanel.UID); } if (deviceUIDs.Count > 1) Errors.Add(new ZoneValidationError(zone, "В охранной зоне указано устройство, находящееся в другом приборе", ValidationErrorLevel.CannotWrite)); } }
public static List<Device> GetRemotePanelsForZone(Device parentPanel, Zone zone) { var devices = new HashSet<Device>(); foreach (var binaryPanel in BinaryConfigurationHelper.Current.BinaryPanels) { if (binaryPanel.ParentPanel != parentPanel) { if (binaryPanel.TempRemoteZones.Contains(zone)) devices.Add(binaryPanel.ParentPanel); } } return devices.ToList(); }
Instruction FindInstruction(Device device, Zone zone) { var availableStateTypeInstructions = FiresecClient.FiresecManager.SystemConfiguration.Instructions.FindAll(x => x.AlarmType == AlarmType); if (device != null) { foreach (var instruction in availableStateTypeInstructions) { if (device.ParentPanel != null && instruction.Devices.Contains(device.ParentPanel.UID)) { return instruction; } if (instruction.Devices.Contains(device.UID)) { return instruction; } } } if (zone != null) { foreach (var instruction in availableStateTypeInstructions) { if (instruction.ZoneUIDs.Contains(zone.UID)) { return instruction; } } foreach (var deviceInZone in zone.DevicesInZone) { foreach (var instruction in availableStateTypeInstructions) { if (instruction.Devices.Contains(deviceInZone.ParentPanel.UID)) { return instruction; } } } } foreach (var instruction in availableStateTypeInstructions) { if (instruction.InstructionType == InstructionType.General) { return instruction; } } return null; }
void ValidateZoneHasDevicesFromDifferentNetworks(Zone zone) { var deviceUIDs = new HashSet<Guid>(); foreach (var device in zone.DevicesInZone) { deviceUIDs.Add(device.ParentChannel.UID); } foreach (var device in zone.DevicesInZoneLogic) { deviceUIDs.Add(device.ParentChannel.UID); } if (deviceUIDs.Count > 1) Errors.Add(new ZoneValidationError(zone, "В зоне указано устройство, находящееся в другой сети RS-485", ValidationErrorLevel.CannotWrite)); }
public SimulationZoneViewModel(Zone zone) { Zone = zone; SetFireCommand = new RelayCommand(OnSetFire, CanSetFire); SetNormCommand = new RelayCommand(OnSetNorm, CanSetNorm); SetAttentionCommand = new RelayCommand(OnSetAttention); SetMPTAutomaticOnCommand = new RelayCommand(OnSetMPTAutomaticOn, CanSetMPTAutomaticOn); SetMPTOnCommand = new RelayCommand(OnSetMPTOn, CanSetMPTOn); SetFirefightingCommand = new RelayCommand(OnFirefighting, CanSetFirefighting); SetGuardSetCommand = new RelayCommand(OnSetGuardSet, CanSetGuardSet); SetGuardUnSetCommand = new RelayCommand(OnSetGuardUnSet, CanSetGuardUnSet); SetLampCommand = new RelayCommand(OnSetLamp, CanSetLamp); SetPCNCommand = new RelayCommand(OnSetPCN, CanSetPCN); SetAlarmCommand = new RelayCommand(OnSetAlarm, CanSetAlarm); }
public static Color GetZoneColor(Zone zone) { Color color = Colors.Black; if (zone != null) switch (zone.ZoneType) { case ZoneType.Fire: color = Colors.Green; break; case ZoneType.Guard: color = Colors.Brown; break; } return color; }
public ZonePainter(PresenterItem presenterItem) : base(presenterItem.Element) { _contextMenu = null; _presenterItem = presenterItem; _presenterItem.ShowBorderOnMouseOver = true; _presenterItem.ContextMenuProvider = CreateContextMenu; _zone = Helper.GetZone((IElementZone)_presenterItem.Element); if (_zone != null) _zone.ZoneState.StateChanged += OnPropertyChanged; _presenterItem.Title = GetZoneTooltip(); //_presenterItem.Cursor = Cursors.Hand; //_presenterItem.ClickEvent += (s, e) => OnShowProperties(); InitializeDevices(); }
void AddLocalZoneToPanel(BinaryPanel binaryPanel, Zone zone) { var binaryZone = new BinaryZone(zone) { ParentPanel = binaryPanel.ParentPanel }; if (!binaryPanel.LocalZones.Contains(zone)) { binaryPanel.LocalZones.Add(zone); binaryPanel.BinaryLocalZones.Add(binaryZone); } if (!binaryZone.BinaryPanels.Contains(binaryPanel)) { binaryZone.BinaryPanels.Add(binaryPanel); } }
void ValidateZoneType(Zone zone) { switch (zone.ZoneType) { case ZoneType.Fire: var guardDevice = zone.DevicesInZone.FirstOrDefault(x => x.Driver.DeviceType == DeviceType.Sequrity); if (guardDevice != null) Errors.Add(new ZoneValidationError(zone, string.Format("В зону не может быть помещено охранное устройство ({0})", guardDevice.PresentationAddress), ValidationErrorLevel.CannotSave)); break; case ZoneType.Guard: var fireDevice = zone.DevicesInZone.FirstOrDefault(x => x.Driver.DeviceType == DeviceType.Fire); if (fireDevice != null) Errors.Add(new ZoneValidationError(zone, string.Format("В зону не может быть помещено пожарное устройство ({0})", fireDevice.PresentationAddress), ValidationErrorLevel.CannotSave)); break; } }
public JournalRecordViewModel(JournalRecord journalRecord) { ShowOnPlanCommand = new RelayCommand(OnShowOnPlan, CanShowOnPlan); ShowTreeCommand = new RelayCommand(OnShowTree, CanShowTree); ShowZoneCommand = new RelayCommand(OnShowZone, CanShowZone); DeviceTime = journalRecord.DeviceTime; SystemTime = journalRecord.SystemTime; ZoneName = journalRecord.ZoneName; Description = journalRecord.Description; DeviceName = journalRecord.DeviceName; PanelName = journalRecord.PanelName; User = journalRecord.User; SubsystemType = journalRecord.SubsystemType; StateType = journalRecord.StateType; Detalization = GetDetalization(journalRecord.Detalization); if (journalRecord.DeviceDatabaseUID != Guid.Empty) Device = ConfigurationCash.DeviceConfiguration.Devices.FirstOrDefault(x => x.UID == journalRecord.DeviceDatabaseUID); else Device = ConfigurationCash.DeviceConfiguration.Devices.FirstOrDefault(x => x.UID == journalRecord.PanelDatabaseUID); Zone = FiresecManager.Zones.FirstOrDefault(x => x.FullPresentationName == journalRecord.ZoneName); }
public static void UnSetZoneGuard(Zone zone) { FiresecManager.UnSetZoneGuard(zone); }
public OPCZoneViewModel(Zone zone) { Zone = zone; }
bool HasExternalZone(Zone zone, Device device) { foreach (var deviceInZone in zone.DevicesInZone) { if (device.ParentPanel.UID == deviceInZone.ParentPanel.UID) { return true; } } return false; }
public int GetZoneLocalSecNo(Zone zone) { if (zone.SecPanelUID != Guid.Empty) { var guardZones = (from guardZone in DeviceConfiguration.Zones orderby guardZone.No where guardZone.SecPanelUID == zone.SecPanelUID select guardZone).ToList(); return guardZones.IndexOf(zone) + 1; } return -1; }
void ConvertZones() { DeviceConfiguration.Zones = new List<Zone>(); if (FiresecConfiguration.zone != null) { foreach (var innerZone in FiresecConfiguration.zone) { var zone = new Zone() { Name = innerZone.name, No = int.Parse(innerZone.no), Description = innerZone.desc }; if (innerZone.shape != null) { zone.ShapeIds = new List<string>(); foreach (var shape in innerZone.shape) { zone.ShapeIds.Add(shape.id); } } if (innerZone.param != null) { var zoneTypeParam = innerZone.param.FirstOrDefault(x => x.name == "ZoneType"); if (zoneTypeParam != null) { zone.ZoneType = (zoneTypeParam.value == "0") ? ZoneType.Fire : ZoneType.Guard; } var exitTimeParam = innerZone.param.FirstOrDefault(x => x.name == "ExitTime"); if (exitTimeParam != null) zone.EvacuationTime = exitTimeParam.value; var fireDeviceCountParam = innerZone.param.FirstOrDefault(x => x.name == "FireDeviceCount"); if (fireDeviceCountParam != null) zone.DetectorCount = int.Parse(fireDeviceCountParam.value); var autoSetParam = innerZone.param.FirstOrDefault(x => x.name == "AutoSet"); if (autoSetParam != null) zone.AutoSet = autoSetParam.value; var delayParam = innerZone.param.FirstOrDefault(x => x.name == "Delay"); if (delayParam != null) zone.Delay = delayParam.value; var skippedParam = innerZone.param.FirstOrDefault(x => x.name == "Skipped"); if (skippedParam != null) zone.Skipped = skippedParam.value == "1" ? true : false; var guardZoneTypeParam = innerZone.param.FirstOrDefault(x => x.name == "GuardZoneType"); if (guardZoneTypeParam != null) { zone.GuardZoneType = (GuardZoneType)int.Parse(guardZoneTypeParam.value); } } DeviceConfiguration.Zones.Add(zone); } } }