static void ValidateZoneFire1Fire2Count(XZone zone) { if (zone.Fire1Count >= zone.Fire2Count) { Errors.Add(new ZoneValidationError(zone, "Количество датчиков для сработки Пожар 1 должно быть меньше количества датчиков для сработки Пожар 2", ValidationErrorLevel.CannotWrite)); } }
public ZoneBinaryObject(XZone zone, DatabaseType databaseType) { DatabaseType = databaseType; ObjectType = ObjectType.Zone; Zone = zone; Build(); }
static void ValidateZoneHasNoDevices(XZone zone) { if (zone.Devices.Count == 0) { Errors.Add(new ZoneValidationError(zone, "К зоне не подключено ни одного устройства", ValidationErrorLevel.CannotWrite)); } }
public ZoneDetailsViewModel(XZone zone = null) { if (zone == null) { Title = "Создание новой зоны"; Zone = new XZone() { Name = "Новая зона", No = 1, Fire1Count = LastFire1Count, Fire2Count = LastFire2Count }; if (XManager.Zones.Count != 0) Zone.No = (ushort)(XManager.Zones.Select(x => x.No).Max() + 1); } else { Title = string.Format("Свойства зоны: {0}", zone.PresentationName); Zone = zone; } CopyProperties(); var availableNames = new HashSet<string>(); var availableDescription = new HashSet<string>(); foreach (var existingZone in XManager.Zones) { availableNames.Add(existingZone.Name); availableDescription.Add(existingZone.Description); } AvailableNames = new ObservableCollection<string>(availableNames); AvailableDescription = new ObservableCollection<string>(availableDescription); }
public static Color GetXZoneColor(XZone zone) { Color color = Colors.Black; if (zone != null) color = Colors.Green; return color; }
static void ValidateZoneDetectorCount(XZone zone) { if (zone.Devices == null || zone.Devices.Any(x => x.Driver.DriverType == XDriverType.HandDetector)) return; if (zone.Fire1Count > zone.Devices.Count) Errors.Add(new ZoneValidationError(zone, "Количество подключенных к зоне датчиков меньше количества датчиков для сработки", ValidationErrorLevel.CannotWrite)); }
public ZoneDescriptor(XZone zone) { DatabaseType = DatabaseType.Gk; DescriptorType = DescriptorType.Zone; Zone = zone; Build(); }
static void ValidateDifferentGK(XZone zone) { if (AreDevicesInSameGK(zone.Devices)) Errors.Add(new ZoneValidationError(zone, "Зона содержит устройства разных ГК", ValidationErrorLevel.CannotWrite)); if (AreDevicesInSameGK(zone.DevicesInLogic)) Errors.Add(new ZoneValidationError(zone, "Зона участвует в логике устройств разных ГК", ValidationErrorLevel.CannotWrite)); }
public static void SetXZone(IElementZone element, XZone xzone) { ResetXZone(element); element.ZoneUID = xzone == null ? Guid.Empty : xzone.UID; element.BackgroundColor = GetXZoneColor(xzone); if (xzone != null) xzone.PlanElementUIDs.Add(element.UID); }
public virtual void AddZone(XZone zone) { if (Zones.Contains(zone)) return; zone.SetDatabaseNo(DatabaseType, NextChildNo); Zones.Add(zone); }
public void Update(XZone zone) { Zone = zone; OnPropertyChanged("Zone"); OnPropertyChanged("Name"); OnPropertyChanged("Description"); Update(); }
public ObjectViewModel(XZone zone) { Zone = zone; Name = zone.PresentationName; ImageSource = "/Controls;component/Images/zone.png"; Address = ""; PresentationZone = ""; ObjectType = ObjectType.Zone; }
public InstructionViewModel(XDevice device, XZone zone, XDirection direction, XAlarmType alarmType) { AlarmType = alarmType; Instruction = FindInstruction(device, zone, direction); Title = Instruction != null ? Instruction.Name : ""; HasContent = Instruction != null; }
public static void AddDeviceToZone(XDevice device, XZone zone) { if (!device.Zones.Contains(zone)) device.Zones.Add(zone); if (!device.ZoneUIDs.Contains(zone.UID)) device.ZoneUIDs.Add(zone.UID); zone.Devices.Add(device); zone.OnChanged(); device.OnChanged(); }
public static void RemoveDeviceFromZone(XDevice device, XZone zone) { if (zone != null) { device.Zones.Remove(zone); device.ZoneUIDs.Remove(zone.UID); zone.Devices.Remove(device); zone.OnChanged(); device.OnChanged(); } }
public static bool CanShowZone(XZone zone) { foreach (var plan in FiresecManager.PlansConfiguration.AllPlans) { if (plan.ElementPolygonXZones.Any(x => (x.ZoneUID != Guid.Empty) && (x.ZoneUID == zone.UID))) return true; if (plan.ElementRectangleXZones.Any(x => (x.ZoneUID != Guid.Empty) && (x.ZoneUID == zone.UID))) return true; } return false; }
static void ValidateZoneDetectorCount(XZone zone) { var fire1Count = zone.Devices.Count(x => x.Driver.AvailableStateBits.Contains(XStateBit.Fire1)); var fire2Count = zone.Devices.Count(x => x.Driver.AvailableStateBits.Contains(XStateBit.Fire2)); if (fire2Count == 0 && fire1Count < zone.Fire1Count) { Errors.Add(new ZoneValidationError(zone, "Количество подключенных к зоне датчиков меньше количества датчиков для сработки Пожар 1", ValidationErrorLevel.CannotWrite)); return; } if (fire2Count == 0 && fire1Count < zone.Fire2Count) { Errors.Add(new ZoneValidationError(zone, "Количество подключенных к зоне датчиков меньше количества датчиков для сработки Пожар 2", ValidationErrorLevel.CannotWrite)); } }
XInstruction FindInstruction(XDevice device, XZone zone, XDirection direction) { var availableStateTypeInstructions = XManager.DeviceConfiguration.Instructions.FindAll(x => x.AlarmType == AlarmType); if (device != null) { foreach (var instruction in availableStateTypeInstructions) { if (instruction.Devices.Contains(device.UID)) { return instruction; } } } if (zone != null) { foreach (var instruction in availableStateTypeInstructions) { if (instruction.ZoneUIDs.Contains(zone.UID)) { return instruction; } } } if (direction != null) { foreach (var instruction in availableStateTypeInstructions) { if (instruction.Directions == null) break; if (instruction.Directions.Contains(direction.UID)) { return instruction; } } } foreach (var instruction in availableStateTypeInstructions) { if (instruction.InstructionType == XInstructionType.General) { return instruction; } } return null; }
public ZoneViewModel(XZone zone) { ResetFireCommand = new RelayCommand(OnResetFire, CanResetFire); SetIgnoreCommand = new RelayCommand(OnSetIgnore, CanSetIgnore); ResetIgnoreCommand = new RelayCommand(OnResetIgnore, CanResetIgnore); SetIgnoreAllCommand = new RelayCommand(OnSetIgnoreAll, CanSetIgnoreAll); ResetIgnoreAllCommand = new RelayCommand(OnResetIgnoreAll, CanResetIgnoreAll); ShowOnPlanCommand = new RelayCommand(OnShowOnPlan, CanShowOnPlan); ShowJournalCommand = new RelayCommand(OnShowJournal); ShowPropertiesCommand = new RelayCommand(OnShowProperties); Zone = zone; State.StateChanged += new System.Action(OnStateChanged); OnStateChanged(); }
public ZoneDetailsViewModel(XZone zone) { ShowCommand = new RelayCommand(OnShow); ShowJournalCommand = new RelayCommand(OnShowJournal); ResetFireCommand = new RelayCommand(OnResetFire, CanResetFire); SetIgnoreCommand = new RelayCommand(OnSetIgnore, CanSetIgnore); ResetIgnoreCommand = new RelayCommand(OnResetIgnore, CanResetIgnore); Zone = zone; State.StateChanged += new Action(OnStateChanged); InitializePlans(); Title = Zone.PresentationName; TopMost = true; }
public XZonePainter(PresenterItem presenterItem) : base(presenterItem.Element) { _contextMenu = null; _presenterItem = presenterItem; _presenterItem.ShowBorderOnMouseOver = true; _presenterItem.ContextMenuProvider = CreateContextMenu; Zone = Helper.GetXZone((IElementZone)_presenterItem.Element); if (Zone != null) { ZoneViewModel = new ViewModels.ZoneViewModel(Zone); Zone.State.StateChanged += OnPropertyChanged; } _presenterItem.Cursor = Cursors.Hand; _presenterItem.ClickEvent += (s, e) => ShowProperties(); UpdateTooltip(); }
public ZoneDetailsViewModel(XZone xZone = null) { if (xZone == null) { Title = "Создание новой зоны"; XZone = new XZone() { Name = "Новая зона", No = 1 }; if (XManager.DeviceConfiguration.Zones.Count != 0) XZone.No = (ushort)(XManager.DeviceConfiguration.Zones.Select(x => x.No).Max() + 1); } else { Title = string.Format("Свойства зоны: {0}", xZone.PresentationName); XZone = xZone; } CopyProperties(); }
public static void EditZone(XZone zone) { foreach (var device in zone.Devices) { device.OnChanged(); } foreach (var device in zone.DevicesInLogic) { device.OnChanged(); } foreach (var direction in zone.Directions) { direction.OnChanged(); } zone.OnChanged(); }
public void GKResetFire2(XZone zone) { if (IsGKAsAService) { SafeOperationCall(() => { FiresecService.GKResetFire2(zone.UID); }, "GKResetFire2"); } else { GKProcessorManager.GKResetFire2(zone, FiresecManager.CurrentUser.Name); } }
public static void GKResetFire2(XZone zone, string userName) { Watcher.SendControlCommand(zone, 0x03, "Сброс Пожар-1"); AddGKMessage(EventName.Команда_оператора, EventDescription.Сброс, zone, userName); }
public static void AddZone(XZone zone) { Zones.Add(zone); }
public static void RemoveZone(XZone zone) { foreach (var device in zone.Devices) { device.Zones.Remove(zone); device.ZoneUIDs.Remove(zone.UID); device.OnChanged(); } foreach (var direction in zone.Directions) { direction.InputZones.Remove(zone); var directionZone = direction.DirectionZones.FirstOrDefault(x => x.Zone == zone); if (directionZone != null) { direction.DirectionZones.Remove(directionZone); direction.InputZones.Remove(zone); } direction.OnChanged(); } Zones.Remove(zone); zone.OnChanged(); }
public static string GetXZoneTitle(XZone xzone) { return xzone == null ? "Несвязанная зона" : xzone.PresentationName; }
public static void ShowZone(XZone zone) { ServiceFactory.Events.GetEvent<ShowXZoneOnPlanEvent>().Publish(zone); }
public ZoneViewModel(XZone zone) { Zone = zone; Update(); }