Exemplo n.º 1
0
		public OPCDetailsViewModel()
		{		
			var zones = GKManager.Zones.Where(x => GKManager.DeviceConfiguration.OPCSettings.ZoneUIDs.Contains(x.UID)).ToList();
			ZonesSelectationViewModel = new ZonesSelectationViewModel(zones, true);
			var guardzones = GKManager.GuardZones.Where(x => GKManager.DeviceConfiguration.OPCSettings.GuardZoneUIDs.Contains(x.UID)).ToList();
			GuardZonesSelectationViewModel = new GuardZonesSelectationViewModel(guardzones);
			var directions = GKManager.Directions.Where(x => GKManager.DeviceConfiguration.OPCSettings.DiretionUIDs.Contains(x.UID)).ToList();
			DirectionsSelectationViewModel = new DirectionsSelectationViewModel(directions);
			var delays = GKManager.Delays.Where(x => GKManager.DeviceConfiguration.OPCSettings.DelayUIDs.Contains(x.UID)).ToList();
			DelaysSelectationViewModel = new DelaysSelectationViewModel(delays);
			var devices = GKManager.Devices.Where(x => GKManager.DeviceConfiguration.OPCSettings.DeviceUIDs.Contains(x.UID)).ToList();
			DevicesSelectationViewModel = new DevicesSelectationViewModel(devices, GKManager.Devices.Where(x => x.Driver.IsReal).ToList());
			var mpts = GKManager.MPTs.Where(x => GKManager.DeviceConfiguration.OPCSettings.MPTUIDs.Contains(x.UID)).ToList();
			MPTsSelectationViewModel = new MPTsSelectationViewModel(mpts);
			var ns = GKManager.PumpStations.Where(x => GKManager.DeviceConfiguration.OPCSettings.NSUIDs.Contains(x.UID)).ToList();
			PumpStationsSelectationViewModel = new PumpStationsSelectationViewModel(ns);
			var doors = GKManager.Doors.Where(x => GKManager.DeviceConfiguration.OPCSettings.DoorUIDs.Contains(x.UID)).ToList();
			DoorsSelectationViewModel = new DoorsSelectationViewModel(doors);
		}
Exemplo n.º 2
0
		void OnSelectGKPumpStations(SelectGKPumpStationsEventArg selectPumpStationsEventArg)
		{
			var pumpStationsSelectionViewModel = new PumpStationsSelectationViewModel(selectPumpStationsEventArg.PumpStations);
			selectPumpStationsEventArg.Cancel = !ServiceFactory.DialogService.ShowModalWindow(pumpStationsSelectionViewModel);
			selectPumpStationsEventArg.PumpStations = pumpStationsSelectionViewModel.TargetPumpStations.ToList();
		}
Exemplo n.º 3
0
		public MirrorViewModel(GKDevice device)
		{
			
			Title = "Выбор настройки отражения";
			Device = device;
			var zones = GKManager.Zones.Where(x => Device.GKReflectionItem.ZoneUIDs.Contains(x.UID)).ToList();
			ZonesSelectationViewModel = new ZonesSelectationViewModel(zones, true);
			var guardzones = GKManager.GuardZones.Where(x => Device.GKReflectionItem.GuardZoneUIDs.Contains(x.UID)).ToList();
			GuardZonesSelectationViewModel = new GuardZonesSelectationViewModel(guardzones);
			var directions = GKManager.Directions.Where(x => Device.GKReflectionItem.DiretionUIDs.Contains(x.UID)).ToList();
			DirectionsSelectationViewModel = new DirectionsSelectationViewModel(directions);
			var delays = GKManager.Delays.Where(x => Device.GKReflectionItem.DelayUIDs.Contains(x.UID)).ToList();
			DelaysSelectationViewModel = new DelaysSelectationViewModel(delays);
			if (device.Driver.DriverType == GKDriverType.DetectorDevicesMirror)
			{
				var devices = GKManager.Devices.Where(x => Device.GKReflectionItem.DeviceUIDs.Contains(x.UID)).ToList();
				DevicesSelectationViewModel = new DevicesSelectationViewModel(devices, GKManager.Devices.Where(x=> x.Driver.HasZone).ToList());
			}
			if (device.Driver.DriverType == GKDriverType.ControlDevicesMirror)
			{
				var devices = GKManager.Devices.Where(x => Device.GKReflectionItem.DeviceUIDs.Contains(x.UID)).ToList();
				DevicesSelectationViewModel = new DevicesSelectationViewModel(devices, GKManager.Devices.Where(x => x.Driver.IsControlDevice).ToList());
			}
			var ns = GKManager.PumpStations.Where(x => Device.GKReflectionItem.NSUIDs.Contains(x.UID)).ToList();
			PumpStationsSelectationViewModel = new PumpStationsSelectationViewModel(ns);
			var mpts = GKManager.MPTs.Where(x => Device.GKReflectionItem.MPTUIDs.Contains(x.UID)).ToList();
			MPTsSelectationViewModel = new MPTsSelectationViewModel(mpts);

			switch (device.Driver.DriverType)
			{
				case GKDriverType.FireZonesMirror:
					HasFireZones = true;
					IsFireZones = true;
					break;

				case GKDriverType.GuardZonesMirror:
					HasGuardZones = true;
					IsGuardZones = true;
					break;

				case GKDriverType.ControlDevicesMirror:
					HasMPT = true;
					HasDevices = true;
					HasDirections = true;
					HasNS = true;
					HasDelay = true;
					IsDevices = DevicesSelectationViewModel.DevicesList.Any();
					IsDirections = !IsDevices && DirectionsSelectationViewModel.TargetDirections.Any();
					IsDelay =!IsDirections &&!IsDevices && DelaysSelectationViewModel.TargetDelays.Any();
					IsNS = !IsDirections && !IsDevices && !IsDelay && PumpStationsSelectationViewModel.TargetPumpStations.Any();
					IsDevices = !(IsMPT = !IsDirections && !IsDevices && !IsDelay &&!IsNS && MPTsSelectationViewModel.TargetMPTs.Any());
					break;

				case GKDriverType.FirefightingZonesMirror:
					HasDirections = true;
					HasFireZones = true;
					IsFireZones = ZonesSelectationViewModel.TargetZones.Any() ? true :  DirectionsSelectationViewModel.TargetDirections.Any() ? !(IsDirections = true) : true ;
					break;

				case GKDriverType.DirectionsMirror:
					HasDirections = true;
					IsDirections = true;
					break;

				case GKDriverType.DetectorDevicesMirror:
					HasDevices = true;
					IsDevices = true;
					break;
			}
		}
Exemplo n.º 4
0
		void OnSelectPumpStations()
		{
			var pumpStationsSelectationViewModel = new PumpStationsSelectationViewModel(PumpStations);
			if (DialogService.ShowModalWindow(pumpStationsSelectationViewModel))
			{
				PumpStations = pumpStationsSelectationViewModel.PumpStations;
				OnPropertyChanged(() => PresenrationPumpStations);
			}
		}