public ZoneListPage(Location location)
 {
     model          = new ZonesViewModel(Navigation, location);
     BindingContext = model;
     InitializeComponent();
     Title = AppResources.ZoneListPage_Title;
 }
Ejemplo n.º 2
0
		public override void CreateViewModels()
		{
			ServiceFactory.Layout.AddAlarmGroups(new AlarmGroupsViewModel());
			ServiceFactory.Layout.AddToolbarItem(new GKConnectionIndicatorViewModel());

			DevicesViewModel = new DevicesViewModel();
			DeviceParametersViewModel = new DeviceParametersViewModel();
			ZonesViewModel = new ZonesViewModel();
			GuardZonesViewModel = new GuardZonesViewModel();
			SKDZonesViewModel = new SKDZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			DelaysViewModel = new DelaysViewModel();
			PimsViewModel = new PimsViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			MPTsViewModel = new MPTsViewModel();
			DoorsViewModel = new DoorsViewModel();
			AlarmsViewModel = new AlarmsViewModel();
			DaySchedulesViewModel = new DaySchedulesViewModel();
			SchedulesViewModel = new SchedulesViewModel();
			ServiceFactory.Events.GetEvent<ShowGKAlarmsEvent>().Unsubscribe(OnShowAlarms);
			ServiceFactory.Events.GetEvent<ShowGKAlarmsEvent>().Subscribe(OnShowAlarms);
			ServiceFactory.Events.GetEvent<ShowGKDebugEvent>().Unsubscribe(OnShowGKDebug);
			ServiceFactory.Events.GetEvent<ShowGKDebugEvent>().Subscribe(OnShowGKDebug);

			SubscribeShowDelailsEvent();
		}
Ejemplo n.º 3
0
        public ActionResult Zones(string SearchTerm = "")
        {
            try
            {
                IEnumerable <IZoneTemplate> validEntries = TemplateCache.GetAll <IZoneTemplate>(true).Where(zone => zone.AlwaysDiscovered);
                ApplicationUser             user         = null;
                string searcher = SearchTerm.Trim().ToLower();

                if (User.Identity.IsAuthenticated)
                {
                    user = UserManager.FindById(User.Identity.GetUserId());
                    StaffRank userRank = user.GetStaffRank(User);
                }

                ZonesViewModel vModel = new ZonesViewModel(validEntries.Where(item => item.Name.ToLower().Contains(searcher)))
                {
                    AuthedUser = user,
                    SearchTerm = SearchTerm,
                };

                return(View(vModel));
            }
            catch (Exception ex)
            {
                LoggingUtility.LogError(ex);
            }

            return(View());
        }
Ejemplo n.º 4
0
		public override void CreateViewModels()
		{
			ServiceFactory.Layout.AddToolbarItem(new ConnectionIndicatorViewModel());
			ServiceFactory.Events.GetEvent<ShowDeviceDetailsEvent>().Subscribe(OnShowDeviceDetails);
			DevicesViewModel = new DevicesViewModel();
			ZonesViewModel = new ZonesViewModel();
		}
Ejemplo n.º 5
0
 public GroupControllerModule()
 {
     _devicesViewModel = new DevicesViewModel();
     _zonesViewModel = new ZonesViewModel();
     _directionsViewModel = new DirectionsViewModel();
     _filtersViewModel = new FiltersViewModel();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// buttonInit_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonInit_Click(object sender, RoutedEventArgs e)
        {
            ZonesViewModel vm = DataContext as ZonesViewModel;

            if (vm != null)
            {
                vm.Raz();
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// buttonStop_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonStop_Click(object sender, RoutedEventArgs e)
        {
            ZonesViewModel vm = DataContext as ZonesViewModel;

            if (vm != null)
            {
                vm.Stop();
            }
            Thread.Sleep(100);
        }
Ejemplo n.º 8
0
 public GKModuleLoader()
 {
     ServiceFactory.Layout.AddToolbarItem(new GKConnectionIndicatorViewModel());
     ServiceFactory.Events.GetEvent<ShowXDeviceDetailsEvent>().Subscribe(OnShowXDeviceDetails);
     DevicesViewModel = new DevicesViewModel();
     ZonesViewModel = new ZonesViewModel();
     DirectionsViewModel = new DirectionsViewModel();
     JournalsViewModel = new JournalsViewModel();
     ArchiveViewModel = new ArchiveViewModel();
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Window_Closed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Closed(object sender, System.EventArgs e)
        {
            ZonesViewModel vm = DataContext as ZonesViewModel;

            if (vm != null)
            {
                vm.Stop();
            }
            Thread.Sleep(100);
        }
Ejemplo n.º 10
0
		public override void CreateViewModels()
		{
			ServiceFactory.Events.GetEvent<CreateZoneEvent>().Subscribe(OnCreateZone);
			ServiceFactory.Events.GetEvent<EditZoneEvent>().Subscribe(OnEditZone);
			ServiceFactory.Events.GetEvent<ShowDeviceEvent>().Subscribe(OnShowDevice);

			DevicesViewModel = new DevicesViewModel();
			DeviceParametersViewModel = new DeviceParametersViewModel();
			ParameterTemplatesViewModel = new ParameterTemplatesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			GuardViewModel = new GuardViewModel();
			SimulationViewModel = new SimulationViewModel();
			_planExtension = new PlanExtension(DevicesViewModel, ZonesViewModel);
		}
Ejemplo n.º 11
0
		public ZonePropertiesViewModel(IElementZone iElementZone, ZonesViewModel zonesViewModel)
		{
			_zonesViewModel = zonesViewModel;
			IElementZone = iElementZone;
			CreateCommand = new RelayCommand(OnCreate);
			EditCommand = new RelayCommand(OnEdit, CanEdit);
			Title = "Свойства фигуры: Зона";
			var zones = XManager.DeviceConfiguration.SortedZones;
			Zones = new ObservableCollection<ZoneViewModel>();
			foreach (var zone in zones)
			{
				var zoneViewModel = new ZoneViewModel(zone);
				Zones.Add(zoneViewModel);
			}
			if (iElementZone.ZoneUID != Guid.Empty)
				SelectedZone = Zones.FirstOrDefault(x => x.Zone.UID == iElementZone.ZoneUID);
			IsHiddenZone = iElementZone.IsHiddenZone;
		}
Ejemplo n.º 12
0
 public override void Start()
 {
     base.Start();
     // create layer
     if (ZoneLayer == null) return;
     Zones.CollectionChanged += Zones_CollectionChanged;
     var defaultColor = "Red";
     foreach (var parameter in Model.Model.Parameters.Where(parameter => string.Equals(parameter.Name.ToLower(), "color"))) {
         defaultColor = parameter.Value;
     }
     ViewModel = new ZonesViewModel { DisplayName = Model.Id, Zones = Zones, Poi = Poi, SelectedColor = defaultColor };
     if (Poi.Labels.ContainsKey(ZoneList.ZoneLabel))
     {
         Zones.FromString(Poi.Labels[ZoneList.ZoneLabel]);
     }
     UpdateInfoFromLabels();
     //Poi.LabelChanged += Poi_LabelChanged;
     //Poi.Changed += Poi_Changed;
 }
Ejemplo n.º 13
0
		public override void CreateViewModels()
		{
			ServiceFactory.Events.GetEvent<CreateXZoneEvent>().Subscribe(OnCreateXZone);
			ServiceFactory.Events.GetEvent<EditXZoneEvent>().Subscribe(OnEditXZone);
			ServiceFactory.Events.GetEvent<CreateXDirectionEvent>().Subscribe(OnCreateXDirection);
			ServiceFactory.Events.GetEvent<EditXDirectionEvent>().Subscribe(OnEditXDirection);

			DevicesViewModel = new DevicesViewModel();
			ParameterTemplatesViewModel = new ParameterTemplatesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			GuardViewModel = new GuardViewModel();
			FiltersViewModel = new FiltersViewModel();
			DeviceLidraryViewModel = new LibraryViewModel();
			InstructionsViewModel = new InstructionsViewModel();
			OPCDevicesViewModel = new OPCDevicesViewModel();
			OPCZonesViewModel = new OPCZonesViewModel();
			OPCDirectionsViewModel = new OPCDirectionsViewModel();
			DiagnosticsViewModel = new DiagnosticsViewModel();
			DescriptorsViewModel = new DescriptorsViewModel();
			_planExtension = new GKPlanExtension(DevicesViewModel, ZonesViewModel, DirectionsViewModel);
		}
Ejemplo n.º 14
0
		public override void CreateViewModels()
		{
			ServiceFactory.Events.GetEvent<SelectGKZoneEvent>().Subscribe(OnSelectGKZone);
			ServiceFactory.Events.GetEvent<SelectGKZonesEvent>().Subscribe(OnSelectGKZones);
			ServiceFactory.Events.GetEvent<SelectGKGuardZoneEvent>().Subscribe(OnSelectGKGuardZone);
			ServiceFactory.Events.GetEvent<SelectGKGuardZonesEvent>().Subscribe(OnSelectGKGuardZones);
			ServiceFactory.Events.GetEvent<SelectGKDelayEvent>().Subscribe(OnSelectGKDelay);
			ServiceFactory.Events.GetEvent<SelectGKDelaysEvent>().Subscribe(OnSelectGKDelays);
			ServiceFactory.Events.GetEvent<SelectGKDirectionEvent>().Subscribe(OnSelectGKDirection);
			ServiceFactory.Events.GetEvent<SelectGKDirectionsEvent>().Subscribe(OnSelectGKDirections);
			ServiceFactory.Events.GetEvent<SelectGKMPTEvent>().Subscribe(OnSelectGKMPT);
			ServiceFactory.Events.GetEvent<SelectGKMPTsEvent>().Subscribe(OnSelectGKMPTs);
			ServiceFactory.Events.GetEvent<SelectGKDoorEvent>().Subscribe(OnSelectGKDoor);
			ServiceFactory.Events.GetEvent<SelectGKDoorsEvent>().Subscribe(OnSelectGKDoors);
			ServiceFactory.Events.GetEvent<SelectGKDeviceEvent>().Subscribe(OnSelectGKDevice);
			ServiceFactory.Events.GetEvent<SelectGKDevicesEvent>().Subscribe(OnSelectGKDevices);
			ServiceFactory.Events.GetEvent<SelectGKPumpStationEvent>().Subscribe(OnSelectGKPumpStation);
			ServiceFactory.Events.GetEvent<SelectGKPumpStationsEvent>().Subscribe(OnSelectGKPumpStations);

			DevicesViewModel = new DevicesViewModel();
			ParameterTemplatesViewModel = new ParameterTemplatesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			DelaysViewModel = new DelaysViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			MPTsViewModel = new MPTsViewModel();
			CodesViewModel = new CodesViewModel();
			GuardZonesViewModel = new GuardZonesViewModel();
			DoorsViewModel = new DoorsViewModel();
			SKDZonesViewModel = new SKDZonesViewModel();
			DeviceLidraryViewModel = new LibraryViewModel();
			OPCViewModel = new OPCsViewModel();
			DescriptorsViewModel = new DescriptorsViewModel();
			DiagnosticsViewModel = new DiagnosticsViewModel();
			_planExtension = new GKPlanExtension();
		}
Ejemplo n.º 15
0
		public override void CreateViewModels()
		{
			ServiceFactory.Layout.AddAlarmGroups(new AlarmGroupsViewModel());
			ServiceFactory.Layout.AddToolbarItem(new GKConnectionIndicatorViewModel());
			ServiceFactory.Events.GetEvent<ShowXJournalEvent>().Unsubscribe(OnShowJournal);
			ServiceFactory.Events.GetEvent<ShowXJournalEvent>().Subscribe(OnShowJournal);
			ServiceFactory.Events.GetEvent<NewXJournalEvent>().Unsubscribe(OnNewJournalRecord);
			ServiceFactory.Events.GetEvent<NewXJournalEvent>().Subscribe(OnNewJournalRecord);
			DevicesViewModel = new DevicesViewModel();
			ZonesViewModel = new ZonesViewModel();
			DirectionsViewModel = new DirectionsViewModel();
			DelaysViewModel = new DelaysViewModel();
			PimsViewModel = new PimsViewModel();
			PumpStationsViewModel = new PumpStationsViewModel();
			JournalsViewModel = new JournalsViewModel();
			ArchiveViewModel = new ArchiveViewModel();
			AlarmsViewModel = new AlarmsViewModel();
			ServiceFactory.Events.GetEvent<ShowXAlarmsEvent>().Unsubscribe(OnShowAlarms);
			ServiceFactory.Events.GetEvent<ShowXAlarmsEvent>().Subscribe(OnShowAlarms);
			ServiceFactory.Events.GetEvent<ShowXArchiveEvent>().Unsubscribe(OnShowArchive);
			ServiceFactory.Events.GetEvent<ShowXArchiveEvent>().Subscribe(OnShowArchive);
			ServiceFactory.Events.GetEvent<ShowGKDebugEvent>().Unsubscribe(OnShowGKDebug);
			ServiceFactory.Events.GetEvent<ShowGKDebugEvent>().Subscribe(OnShowGKDebug);
		}
Ejemplo n.º 16
0
		public void Add()
		{
			MockDialogService.OnShowModal += x =>
			{
				(x as ZoneDetailsViewModel).Name = "Test Zone";
				(x as ZoneDetailsViewModel).SaveCommand.Execute();

			};

			MockMessageBoxService.ShowConfirmationResult = true;

			var zonesViewModel = new ZonesViewModel();
			zonesViewModel.Initialize();
			zonesViewModel.OnShow();

			Assert.IsFalse(zonesViewModel.DeleteCommand.CanExecute(null));
			Assert.IsTrue(zonesViewModel.Zones.Count == 0);
			Assert.IsTrue(zonesViewModel.SelectedZone == null);
			zonesViewModel.AddCommand.Execute();
			Assert.IsTrue(zonesViewModel.Zones.Count == 1);
			Assert.IsTrue(zonesViewModel.SelectedZone != null);
			Assert.IsTrue(zonesViewModel.Zones.FirstOrDefault().Zone.Name == "Test Zone");

			Assert.IsTrue(zonesViewModel.DeleteCommand.CanExecute(null));
			zonesViewModel.DeleteCommand.Execute();
			Assert.IsTrue(zonesViewModel.Zones.Count == 0);
			Assert.IsTrue(GKManager.Zones.Count == 0);
		}
Ejemplo n.º 17
0
		public void AddDeviceToZone()
		{
			var device1 = AddDevice(kauDevice11, GKDriverType.RSR2_SmokeDetector);
			var device2 = AddDevice(kauDevice11, GKDriverType.RSR2_SmokeDetector);
			var device3 = AddDevice(kauDevice11, GKDriverType.RSR2_SmokeDetector);
			var zone = new GKZone();
			GKManager.AddZone(zone);
			GKManager.UpdateConfiguration();

			var zonesViewModel = new ZonesViewModel();
			zonesViewModel.Initialize();
			zonesViewModel.OnShow();
			Assert.IsTrue(zonesViewModel.ZoneDevices.Devices.Count == 0);
			Assert.IsTrue(zonesViewModel.ZoneDevices.AvailableDevices.Count == 3);
			zonesViewModel.ZoneDevices.AddCommand.Execute(zonesViewModel.ZoneDevices.AvailableDevices.Where(x => x.Device.UID == device1.UID).ToList());
			Assert.IsTrue(zonesViewModel.ZoneDevices.Devices.Count == 1);
			Assert.IsTrue(zonesViewModel.ZoneDevices.AvailableDevices.Count == 2);
			Assert.IsTrue(zone.Devices.Count == 1);
			Assert.IsTrue(device1.Zones.Count == 1);
		}
Ejemplo n.º 18
0
		public void AddDeviceToNoZone()
		{
			AddDevice(kauDevice11, GKDriverType.RSR2_SmokeDetector);
			AddDevice(kauDevice11, GKDriverType.RSR2_SmokeDetector);
			AddDevice(kauDevice11, GKDriverType.RSR2_SmokeDetector);
			GKManager.UpdateConfiguration();

			var zonesViewModel = new ZonesViewModel();
			zonesViewModel.Initialize();
			zonesViewModel.OnShow();
			Assert.IsTrue(zonesViewModel.ZoneDevices.Devices.Count == 0);
			Assert.IsTrue(zonesViewModel.ZoneDevices.AvailableDevices.Count == 0);
		}
Ejemplo n.º 19
0
		public void AddCancel()
		{
			MockDialogService.OnShowModal += x =>
			{
				(x as ZoneDetailsViewModel).CancelCommand.Execute();

			};

			var zonesViewModel = new ZonesViewModel();
			zonesViewModel.Initialize();
			zonesViewModel.OnShow();

			Assert.IsTrue(zonesViewModel.Zones.Count == 0);
			Assert.IsTrue(zonesViewModel.SelectedZone == null);
			zonesViewModel.AddCommand.Execute();
			Assert.IsTrue(zonesViewModel.Zones.Count == 0);
			Assert.IsTrue(zonesViewModel.SelectedZone == null);
		}
Ejemplo n.º 20
0
		public ZonePolygonAdorner(CommonDesignerCanvas designerCanvas, ZonesViewModel zonesViewModel)
			: base(designerCanvas)
		{
			_zonesViewModel = zonesViewModel;
		}
Ejemplo n.º 21
0
		public ZoneRectangleAdorner(CommonDesignerCanvas designerCanvas, ZonesViewModel zonesViewModel)
			: base(designerCanvas)
		{
			_zonesViewModel = zonesViewModel;
		}
Ejemplo n.º 22
0
		public override void CreateViewModels()
		{
			DiagnosticsViewModel = new DiagnosticsViewModel();
			ZonesViewModel = new ZonesViewModel();
		}
Ejemplo n.º 23
0
 public ZonesMenuViewModel(ZonesViewModel context)
 {
     Context = context;
 }
Ejemplo n.º 24
0
        /// <summary>
        /// Window_Loaded
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            ZonesViewModel vm = new ZonesViewModel();

            DataContext = vm;
        }
Ejemplo n.º 25
0
		public IEnumerable<ILayoutPartPresenter> GetLayoutParts()
		{
			yield return new LayoutPartPresenter(LayoutPartIdentities.Alarms, "Состояния", "BAlarm.png", (p) => 
			{
				foreach (var alarm in AlarmsViewModel.Alarms)
				{
					alarm.InitializePlanLink();
				}
				return AlarmsViewModel;
			}
				
				);
			yield return new LayoutPartPresenter(LayoutPartIdentities.GDevices, "Устройства", "BTree.png", (p) =>
			{ DevicesViewModel.Properties = p as LayoutPartAdditionalProperties; return DevicesViewModel; });
			if (LicenseManager.CurrentLicenseInfo.HasFirefighting)
				yield return new LayoutPartPresenter(LayoutPartIdentities.Zones, "Зоны", "BZones.png", (p) =>
					{
						var zonesViewModel = new ZonesViewModel();
						zonesViewModel.Initialize();
						zonesViewModel.Properties = p as LayoutPartAdditionalProperties;
						return zonesViewModel;
					});
			if (LicenseManager.CurrentLicenseInfo.HasGuard)
				yield return new LayoutPartPresenter(LayoutPartIdentities.GuardZones, "Охранные зоны", "BZones.png", (p) =>
					{
						var guardZonesViewModel = new GuardZonesViewModel();
						guardZonesViewModel.Initialize();
						guardZonesViewModel.Properties = p as LayoutPartAdditionalProperties;
						return guardZonesViewModel;
					});
			if (LicenseManager.CurrentLicenseInfo.HasSKD)
				yield return new LayoutPartPresenter(LayoutPartIdentities.GKSKDZones, "Зоны СКД", "BZones.png", (p) => SKDZonesViewModel);
			yield return new LayoutPartPresenter(LayoutPartIdentities.Directions, "Направления", "BDirection.png", (p) => DirectionsViewModel);
			yield return new LayoutPartPresenter(LayoutPartIdentities.PumpStations, "НС", "BPumpStation.png", (p) => PumpStationsViewModel);
			yield return new LayoutPartPresenter(LayoutPartIdentities.MPTs, "МПТ", "BMPT.png", (p) =>
				{ MPTsViewModel.Properties = p as LayoutPartAdditionalProperties; return MPTsViewModel; });
			yield return new LayoutPartPresenter(LayoutPartIdentities.Delays, "Задержки", "Delay.png", (p) => DelaysViewModel);
			if (LicenseManager.CurrentLicenseInfo.HasSKD)
				yield return new LayoutPartPresenter(LayoutPartIdentities.Doors, "Точки доступа", "Door.png", (p) =>
					{ DoorsViewModel.Properties = p as LayoutPartAdditionalProperties; return DoorsViewModel; });
			yield return new LayoutPartPresenter(LayoutPartIdentities.ConnectionIndicator, "Индикатор связи", "BConnectionIndicator.png", (p) => new GKConnectionIndicatorViewModel());
		}