Пример #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);
		}
Пример #2
0
		public void ChangePumpDevices()
		{
			var sourceDevices = new List<XDevice>();
			foreach (var device in XManager.Devices)
			{
				if ((device.Driver.DriverType == XDriverType.FirePump)||(device.Driver.DriverType == XDriverType.JockeyPump))
				{
					sourceDevices.Add(device);
				}
			}

			var devicesSelectationViewModel = new DevicesSelectationViewModel(PumpStation.NSDevices, sourceDevices);
			if (DialogService.ShowModalWindow(devicesSelectationViewModel))
			{
				PumpStation.NSDevices = devicesSelectationViewModel.DevicesList;
				PumpStation.NSDeviceUIDs = new List<Guid>();
				foreach (var device in PumpStation.NSDevices)
				{
					PumpStation.NSDeviceUIDs.Add(device.UID);
				}
				Update();
				ServiceFactory.SaveService.GKChanged = true;
			}
		}
Пример #3
0
		void OnSelectGKDevices(SelectGKDevicesEventArg selectDevicesEventArg)
		{
			var devicesSelectionViewModel = new DevicesSelectationViewModel(selectDevicesEventArg.Devices);
			selectDevicesEventArg.Cancel = !ServiceFactory.DialogService.ShowModalWindow(devicesSelectionViewModel);
			selectDevicesEventArg.Devices = devicesSelectionViewModel.DevicesList;
		}
Пример #4
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;
			}
		}
Пример #5
0
		public void ChangePumpDevices()
		{
			var sourceDevices = new List<GKDevice>();
			foreach (var device in GKManager.Devices)
			{
				if (device.Driver.DriverType == GKDriverType.RSR2_Bush_Drenazh || device.Driver.DriverType == GKDriverType.RSR2_Bush_Jokey || device.Driver.DriverType == GKDriverType.RSR2_Bush_Fire)
				{
					sourceDevices.Add(device);
				}
			}

			var devicesSelectationViewModel = new DevicesSelectationViewModel(PumpStation.NSDevices, sourceDevices);
			if (DialogService.ShowModalWindow(devicesSelectationViewModel))
			{
				GKManager.ChangePumpDevices(PumpStation, devicesSelectationViewModel.DevicesList);
				ServiceFactory.SaveService.GKChanged = true;
			}
		}
Пример #6
0
		void OnSelectDevices()
		{
			var sourceDevices = new List<XDevice>();
			foreach (var device in XManager.Devices)
			{
				if (device.IsNotUsed)
					continue;
				if (Device.DriverType == XDriverType.GKRele)
				{

				}
				else
				{
					if (!device.Driver.IsDeviceOnShleif && Device.Driver.IsDeviceOnShleif)
						continue;
				}
				if (device.UID == Device.UID)
					continue;
				if (device.Driver.AvailableStateBits.Contains(SelectedStateType))
					sourceDevices.Add(device);
			}
			var devicesSelectationViewModel = new DevicesSelectationViewModel(Devices, sourceDevices);
			if (DialogService.ShowModalWindow(devicesSelectationViewModel))
			{
				Devices = devicesSelectationViewModel.DevicesList;
				OnPropertyChanged("PresenrationDevices");
			}
		}
		void OnSelectDeviceCommand()
		{
			var devices = new List<XDevice>();
			foreach (var uid in InstructionDevices)
			{
				var device = XManager.Devices.FirstOrDefault(x => x.UID == uid);
				if (device != null)
					devices.Add(device);
			}
			var sourceDevices = new List<XDevice>();
			foreach (var device in XManager.Devices)
			{
				if (device.Driver.IsDeviceOnShleif)
					sourceDevices.Add(device);
			}
			var devicesSelectationViewModel = new DevicesSelectationViewModel(devices, sourceDevices);
			if (DialogService.ShowModalWindow(devicesSelectationViewModel))
			{
				var uids = devicesSelectationViewModel.Devices.Select(x => x.UID).ToList();
				InstructionDevices = new ObservableCollection<Guid>(uids);
			}
		}
Пример #8
0
 void OnSelectDevices()
 {
     var devicesSelectationViewModel = new DevicesSelectationViewModel(Devices);
     if (DialogService.ShowModalWindow(devicesSelectationViewModel))
     {
         Devices = devicesSelectationViewModel.DevicesList;
         OnPropertyChanged("PresenrationDevices");
     }
 }
Пример #9
0
		public void ChangeOutputDevices()
		{
			var sourceDevices = new List<XDevice>();
			foreach (var device in XManager.Devices)
			{
				if (device.Driver.IsDeviceOnShleif && device.Driver.HasLogic)
					sourceDevices.Add(device);
			}

			var devicesSelectationViewModel = new DevicesSelectationViewModel(Direction.OutputDevices, sourceDevices);
			if (DialogService.ShowModalWindow(devicesSelectationViewModel))
			{
				SetNewOutputDevices(devicesSelectationViewModel.DevicesList);
				InitializeDependences();
				ServiceFactory.SaveService.GKChanged = true;
			}
		}
Пример #10
0
		void OnSelectDevices()
		{
			var sourceDevices = new List<GKDevice>();
			foreach (var device in GKManager.Devices)
			{
				if (device.Driver.AvailableStateBits.Contains(SelectedStateType.StateBit))
					sourceDevices.Add(device);
			}
			var devicesSelectationViewModel = new DevicesSelectationViewModel(Devices, sourceDevices);
			if (ServiceFactory.DialogService.ShowModalWindow(devicesSelectationViewModel))
			{
				Devices = devicesSelectationViewModel.DevicesList;
				OnPropertyChanged(() => PresenrationDevices);
			}
		}