예제 #1
0
		public void TestControlDevice()
		{
			var device = AddDevice(kauDevice, GKDriverType.RSR2_RM_1);
			Test(device, GKDriverType.ControlDevicesMirror);

			var direction = new GKDirection();
			GKManager.AddDirection(direction);
			Test(direction, GKDriverType.ControlDevicesMirror);

			var delay = new GKDelay();
			GKManager.AddDelay(delay);
			Test(delay, GKDriverType.ControlDevicesMirror);

			var mpt = new GKMPT();
			GKManager.AddMPT(mpt);
			Test(mpt, GKDriverType.ControlDevicesMirror);
			var mptDevice = AddDevice(kauDevice, GKDriverType.RSR2_RM_1);
			mpt.MPTDevices.Add(new GKMPTDevice { Device = mptDevice, DeviceUID = mptDevice.UID, MPTDeviceType = GKMPTDeviceType.Speaker });
			Compile();
			CheckDeviceLogicOnGK(mptDevice);

			var pumpStation = new GKPumpStation();
			GKManager.AddPumpStation(pumpStation);
			Test(pumpStation, GKDriverType.ControlDevicesMirror);

			var nsDevice = AddDevice(kauDevice, GKDriverType.RSR2_Bush_Fire);
			GKManager.ChangePumpDevices(pumpStation, new List<GKDevice> { nsDevice });
			Compile();
			CheckDeviceLogicOnGK(nsDevice);
			Assert.IsNotNull(pumpStation.Pim);
			CheckObjectOnGK(pumpStation.Pim);
		}
예제 #2
0
파일: GKState.cs 프로젝트: xbadcode/Rubezh
		public GKState(GKDirection direction)
			: this()
		{
			Direction = direction;
			UID = direction.UID;
			BaseObjectType = GKBaseObjectType.Direction;
		}
예제 #3
0
		public Direction(GKDirection gkDirection)
			: base(gkDirection)
		{
			var stateClass = gkDirection.State.StateClass;
			var stateClasses = gkDirection.State.StateClasses;

			No = gkDirection.No;
			Delay = gkDirection.Delay;
			Hold = gkDirection.Hold;
			DelayRegime = gkDirection.DelayRegime.ToDescription();
			Logic = GKManager.GetPresentationLogic(gkDirection.Logic);
			GKDescriptorNo = gkDirection.GKDescriptorNo;

			State = stateClass.ToDescription();
			StateIcon = stateClass.ToString();
			StateColor = "'#" + new XStateClassToColorConverter2().Convert(stateClass, null, null, null).ToString().Substring(3) + "'";
			StateClasses = stateClasses.Select(x => new StateClass(x)).ToList();

			OnDelay = gkDirection.State.OnDelay != 0 ?  gkDirection.State.OnDelay.ToString() : string.Empty;
			HoldDelay = gkDirection.State.HoldDelay != 0 ?  gkDirection.State.HoldDelay.ToString() : string.Empty;
			HasOnDelay = stateClasses.Contains(XStateClass.TurningOn) && gkDirection.State.OnDelay > 0;
			HasHoldDelay = stateClasses.Contains(XStateClass.On) && gkDirection.State.HoldDelay > 0;

			var controlRegime = stateClasses.Contains(XStateClass.Ignore)
				? DeviceControlRegime.Ignore
				: !stateClasses.Contains(XStateClass.AutoOff) ? DeviceControlRegime.Automatic : DeviceControlRegime.Manual;
			ControlRegimeIcon = (new DeviceControlRegimeToIconConverter()).Convert(controlRegime);
			ControlRegimeName = controlRegime.ToDescription();
			CanSetAutomaticState = (controlRegime != DeviceControlRegime.Automatic);
			CanSetManualState = (controlRegime != DeviceControlRegime.Manual);
			CanSetIgnoreState = (controlRegime != DeviceControlRegime.Ignore);
			IsControlRegime = (controlRegime == DeviceControlRegime.Manual);
		}
예제 #4
0
		public DirectionViewModel(GKDirection direction)
		{
			ShowLogicCommand = new RelayCommand(OnShowLogic);
			Direction = direction;
			Direction.Changed += Update;
			Direction.PlanElementUIDsChanged += UpdateVisualizationState;
			Update();
		}
		public DirectionSelectionViewModel(GKDirection direction)
		{
			Title = "Выбор направления";
			Directions = new ObservableCollection<DirectionViewModel>();
			GKManager.Directions.ForEach(x => Directions.Add(new DirectionViewModel(x)));
			if (direction != null)
				SelectedDirection = Directions.FirstOrDefault(x => x.Direction.UID == direction.UID);
			if (SelectedDirection == null)
				SelectedDirection = Directions.FirstOrDefault();
		}
예제 #6
0
		public DirectionViewModel(GKDirection direction)
		{
			ShowOnPlanCommand = new RelayCommand(OnShowOnPlan, CanShowOnPlan);
			ShowJournalCommand = new RelayCommand(OnShowJournal);
			ShowPropertiesCommand = new RelayCommand(OnShowProperties);
			ShowOnPlanOrPropertiesCommand = new RelayCommand(OnShowOnPlanOrProperties);
			Direction = direction;
			State.StateChanged += new System.Action(OnStateChanged);
			OnStateChanged();
		}
		public DirectionPropertiesViewModel(GKDirection direction)
		{
			Title = "Параметры направления";
			Direction = direction;

			DelayRegimes = Enum.GetValues(typeof(DelayRegime)).Cast<DelayRegime>().ToList();
			DelayRegime = Direction.DelayRegime;
			Delay = Direction.Delay;
			Hold = Direction.Hold;
		}
예제 #8
0
		public GKDirection Clone()
		{
			var direction = new GKDirection();
			direction.Name = Name;
			direction.Description = Description;
			direction.Delay = Delay;
			direction.Hold = Hold;
			direction.DelayRegime = DelayRegime;
			direction.Logic.OnClausesGroup = Logic.OnClausesGroup.Clone();
			direction.Logic.OffClausesGroup = Logic.OffClausesGroup.Clone();
			direction.Logic.StopClausesGroup = Logic.StopClausesGroup.Clone();
			direction.Logic.OnNowClausesGroup = Logic.OnNowClausesGroup.Clone();
			direction.Logic.OffNowClausesGroup = Logic.OffNowClausesGroup.Clone();
			return direction;
		}
예제 #9
0
		/// <summary>
		/// Удаление направления
		/// </summary>
		/// <param name="direction"></param>
		public static void RemoveDirection(GKDirection direction)
		{
			Directions.Remove(direction);
			direction.InputDependentElements.ForEach(x =>
			{
				x.OutputDependentElements.Remove(direction);
			});

			direction.OutputDependentElements.ForEach(x =>
			{
				x.InputDependentElements.Remove(direction);
				x.UpdateLogic(DeviceConfiguration);
				x.OnChanged();
			});
			direction.OnChanged();
		}
예제 #10
0
		public DirectionDetailsViewModel(GKDirection direction)
		{
			Direction = direction;
			Title = Direction.PresentationName;
			State.StateChanged += new Action(OnStateChanged);
			PlanLinks = new PlanLinksViewModel(Direction);

			ShowCommand = new RelayCommand(OnShow);
			ShowJournalCommand = new RelayCommand(OnShowJournal);
			SetAutomaticStateCommand = new RelayCommand(OnSetAutomaticState, CanSetAutomaticState);
			SetManualStateCommand = new RelayCommand(OnSetManualState, CanSetManualState);
			SetIgnoreStateCommand = new RelayCommand(OnSetIgnoreState, CanSetIgnoreState);
			TurnOnCommand = new RelayCommand(OnTurnOn);
			TurnOnNowCommand = new RelayCommand(OnTurnOnNow);
			TurnOffCommand = new RelayCommand(OnTurnOff);
			ForbidStartCommand = new RelayCommand(OnForbidStart);
		}
예제 #11
0
        public DirectionViewModel(GKDirection direction)
		{
            Direction = direction;
			DirectionState = direction.State;
            _stateClass = direction.State.StateClass;
            direction.State.StateChanged += new Action(OnStateChanged);
            No = direction.State.Direction.No;
            Name = direction.State.Direction.Name;

            SetAutomaticStateCommand = new RelayCommand(OnSetAutomaticState, CanSetAutomaticState);
            SetManualStateCommand = new RelayCommand(OnSetManualState, CanSetManualState);
            SetIgnoreStateCommand = new RelayCommand(OnSetIgnoreState, CanSetIgnoreState);
            TurnOnCommand = new RelayCommand(OnTurnOn);
            TurnOnNowCommand = new RelayCommand(OnTurnOnNow);
            TurnOffCommand = new RelayCommand(OnTurnOff);
            ForbidStartCommand = new RelayCommand(OnForbidStart);


		}
예제 #12
0
		public void TestDirectionInMultiGk()
		{
			var device1 = AddDevice(kauDevice11, GKDriverType.RSR2_GuardDetector);
			var device2 = AddDevice(kauDevice21, GKDriverType.RSR2_GuardDetector);
			var direction = new GKDirection();
			GKManager.Directions.Add(direction);
			var clause = new GKClause
			{
				ClauseOperationType = ClauseOperationType.AllDevices,
				StateType = GKStateBit.Failure,
				DeviceUIDs = {device1.UID, device2.UID}
			};
			direction.Logic.OnClausesGroup.Clauses.Add(clause);
			var validator = new Validator();
			var errors = validator.Validate();
			Assert.IsTrue(
				errors.Any(
					x => x.ErrorLevel == ValidationErrorLevel.CannotWrite && x.Error == "Содержится в нескольких ГК"));
		}
예제 #13
0
		public DirectionDetailsViewModel(GKDirection direction = null)
		{
			ReadPropertiesCommand = new RelayCommand(OnReadProperties);
			WritePropertiesCommand = new RelayCommand(OnWriteProperties);
			ResetPropertiesCommand = new RelayCommand(OnResetProperties);
			DelayRegimes = Enum.GetValues(typeof(DelayRegime)).Cast<DelayRegime>().ToList();

			if (direction == null)
			{
				Title = "Создание нового направления";
				IsEdit = false;

				Direction = new GKDirection()
				{
					Name = "Новое направление",
					No = 1
				};
				if (GKManager.Directions.Count != 0)
					Direction.No = (GKManager.Directions.Select(x => x.No).Max() + 1);
			}
			else
			{
				Title = string.Format("Свойства направления: {0}", direction.PresentationName);
				Direction = direction;
				IsEdit = true;
			}
			CopyProperties();

			var availableNames = new HashSet<string>();
			var availableDescription = new HashSet<string>();
			foreach (var existingDirection in GKManager.Directions)
			{
				availableNames.Add(existingDirection.Name);
				availableDescription.Add(existingDirection.Description);
			}
			AvailableNames = new ObservableCollection<string>(availableNames);
			AvailableDescription = new ObservableCollection<string>(availableDescription);
		}
예제 #14
0
		public void CheckExistingDirectionTest()
		{
			var direction = new GKDirection()
			{
				Name = "Test 2 Direction"
			};
			GKManager.AddDirection(direction);
			CreateGroupControllerModule();
			var directionsViewModel = GroupControllerModule.DirectionsViewModel;
			directionsViewModel.OnShow();
			Assert.IsTrue(directionsViewModel.Directions.Count == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Name == "Test 2 Direction");
		}
예제 #15
0
		public DirectionDescriptor(GKDirection direction)
			: base(direction)
		{
			DescriptorType = DescriptorType.Direction;
			Direction = direction;
		}
예제 #16
0
		bool Parse(List<byte> bytes, int descriptorNo)
		{
			var internalType = BytesHelper.SubstructShort(bytes, 0);
			var controllerAdress = BytesHelper.SubstructShort(bytes, 2);
			var adressOnController = BytesHelper.SubstructShort(bytes, 4);
			var physicalAdress = BytesHelper.SubstructShort(bytes, 6);
			if (internalType == 0)
				return true;
			var description = BytesHelper.BytesToStringDescription(bytes);
			var driver = GKManager.Drivers.FirstOrDefault(x => x.DriverTypeNo == internalType);
			if (driver != null)
			{
				if (driver.DriverType == GKDriverType.GK && descriptorNo > 1)
				{
					if (bytes.Count <= 0x3a)
					{
						driver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.GKMirror);
					}
					else if (bytes[0x3a] == 1)
					{
						driver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU);
					}
				}

				var shleifNo = (byte)(physicalAdress / 256) + 1;
				var device = new GKDevice
				{
					Driver = driver,
					DriverUID = driver.UID,
					IntAddress = (byte)(physicalAdress % 256),
				};
				if (driver.DriverType == GKDriverType.GK)
				{
					device.Properties.Add(new GKProperty { Name = "IPAddress", StringValue = IpAddress });
					ControllerDevices.Add(controllerAdress, device);
					DeviceConfiguration.RootDevice.Children.Add(device);
					GkDevice = device;
				}
				if (driver.IsKau)
				{
					device.IntAddress = (byte)(controllerAdress % 256);
					var modeProperty = new GKProperty
					{
						Name = "Mode",
						Value = (byte)(controllerAdress / 256)
					};
					device.DeviceProperties.Add(modeProperty);
					ControllerDevices.Add(controllerAdress, device);
					GkDevice.Children.Add(device);
					for (int i = 0; i < 8; i++)
					{
						var shleif = new GKDevice();
						shleif.Driver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.RSR2_KAU_Shleif);
						shleif.DriverUID = shleif.Driver.UID;
						shleif.IntAddress = (byte)(i + 1);
						device.Children.Add(shleif);
					}
				}

				if (driver.DriverType == GKDriverType.GKMirror)
				{
					device.IntAddress = (byte)(controllerAdress % 256);
					var modeProperty = new GKProperty
					{
						Name = "Mode",
						Value = (byte)(controllerAdress / 256)
					};
					device.DeviceProperties.Add(modeProperty);
					ControllerDevices.Add(controllerAdress, device);
					GkDevice.Children.Add(device);
				}

				if (driver.DriverType != GKDriverType.GK && !driver.IsKau && driver.DriverType != GKDriverType.GKMirror && driver.DriverType != GKDriverType.System)
				{
					var controllerDevice = ControllerDevices.FirstOrDefault(x => x.Key == controllerAdress);
					if (controllerDevice.Value != null)
					{
						if (driver.DriverType == GKDriverType.GKIndicator && controllerDevice.Value.Driver.IsKau)
						{
							device.Driver = GKManager.Drivers.FirstOrDefault(x => x.DriverType == GKDriverType.KAUIndicator);
							device.DriverUID = device.Driver.UID;
						}
						if (1 <= shleifNo && shleifNo <= 8 && physicalAdress != 0)
						{
							var shleif = controllerDevice.Value.Children.FirstOrDefault(x => (x.DriverType == GKDriverType.RSR2_KAU_Shleif) && x.IntAddress == shleifNo);
							shleif.Children.Add(device);
						}
						else
						{
							if (controllerDevice.Value.Driver.DriverType == GKDriverType.GK)
								device.IntAddress = (byte)(controllerDevice.Value.Children.Count(x => !x.Driver.HasAddress) + 2);
							else
								device.IntAddress = (byte)(controllerDevice.Value.Children.Count(x => !x.Driver.HasAddress) + 1);
							controllerDevice.Value.Children.Add(device);
						}
					}
				}
				return true;
			}

			if (internalType == 0x100 || internalType == 0x106 || internalType == 0x108 || internalType == 0x109 || internalType == 0x104)
			{
				var isMPT = false;
				var isPumpStation = false;
				ushort no = 0;

				try
				{
					if (description.StartsWith("MПТ."))
					{
						isMPT = true;
					}
					else
					{
						if (description[0] == '0')
							isPumpStation = true;
						no = (ushort)Int32.Parse(description.Substring(0, description.IndexOf(".")));
					}
					description = description.Substring(description.IndexOf(".") + 1);
				}
				catch
				{
					Error = "Невозможно получить номер объекта с дескриптором " + descriptorNo;
					return false;
				}

				if (internalType == 0x100)
				{
					var zone = new GKZone
					{
						Name = description,
						No = no,
						GkDatabaseParent = GkDevice
					};
					DeviceConfiguration.Zones.Add(zone);
					return true;
				}
				if (internalType == 0x106)
				{
					if (isPumpStation)
					{
						var pumpStation = new GKPumpStation()
						{
							Name = description,
							No = no,
							GkDatabaseParent = GkDevice
						};
						DeviceConfiguration.PumpStations.Add(pumpStation);
					}
					else if (isMPT)
					{
						var mpt = new GKMPT()
						{
							Name = description,
							GkDatabaseParent = GkDevice
						};
						DeviceConfiguration.MPTs.Add(mpt);
					}
					else
					{
						var direction = new GKDirection
						{
							Name = description,
							No = no,
							GkDatabaseParent = GkDevice
						};
						DeviceConfiguration.Directions.Add(direction);
					}
					return true;
				}
				if (internalType == 0x108)
				{
					var guardZone = new GKGuardZone
					{
						Name = description,
						No = no,
						GkDatabaseParent = GkDevice
					};
					DeviceConfiguration.GuardZones.Add(guardZone);
					return true;
				}
				if (internalType == 0x109)
				{
					var code = new GKCode
					{
						Name = description,
						No = no,
						GkDatabaseParent = GkDevice
					};
					DeviceConfiguration.Codes.Add(code);
					return true;
				}
				if (internalType == 0x104)
				{
					var door = new GKDoor
					{
						Name = description,
						No = no,
						GkDatabaseParent = GkDevice
					};
					DeviceConfiguration.Doors.Add(door);
					return true;
				}
			}
			return true;
		}
예제 #17
0
		/// <summary>
		/// Добавление направления
		/// </summary>
		/// <param name="direction"></param>
		public static void AddDirection(GKDirection direction)
		{
			Directions.Add(direction);
		}
예제 #18
0
		public void DeleteAllEmptyDirectionTest()
		{
			MockMessageBoxService.ShowConfirmationResult = true;
			var direction = new GKDirection()
			{
				Name = "Test Direction"
			};
			var direction_1 = new GKDirection()
			{
				Name = "Test1Direction"
			};
			var direction_2 = new GKDirection()
			{
				Name = "Test2Direction"
			};
			GKManager.AddDirection(direction);
			GKManager.AddDirection(direction_1);
			GKManager.AddDirection(direction_2);
			CreateGroupControllerModule();

			MockDialogService.OnShowModal += x =>
			{
				var logicViewModel = x as LogicViewModel;
				if (logicViewModel != null)
				{
					logicViewModel.OnClausesGroup.Clauses[0].SelectedClauseOperationType = ClauseOperationType.AnyDevice;
					logicViewModel.OnClausesGroup.Clauses[0].SelectedStateType = logicViewModel.OnClausesGroup.Clauses[0].StateTypes.FirstOrDefault(y => y.StateBit == GKStateBit.Failure);
					logicViewModel.OnClausesGroup.Clauses[0].SelectDevicesCommand.Execute();
					logicViewModel.SaveCommand.Execute();
				}
			};

			MockDialogService.OnShowModal += x =>
			 {
				 var devicesSelectationViewModel = x as DevicesSelectationViewModel;
				 if (devicesSelectationViewModel != null)
				 {
					 devicesSelectationViewModel.AddCommand.Execute(devicesSelectationViewModel.AvailableDevices.Where(y => y.DriverType == GKDriverType.RSR2_KAU).ToList());
					 devicesSelectationViewModel.SaveCommand.Execute();
				 }
			 };

			var directionsViewModel = GroupControllerModule.DirectionsViewModel;
			directionsViewModel.OnShow();
			directionsViewModel.SelectedDirection = directionsViewModel.Directions[2];
			Assert.IsTrue(directionsViewModel.Directions.Count == 3);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Name == "Test2Direction");
			directionsViewModel.SelectedDirection.ShowLogicCommand.Execute();
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Logic.OnClausesGroup.Clauses.Count == 1);
			directionsViewModel.DeleteAllEmptyCommand.Execute();
			Assert.IsTrue(directionsViewModel.Directions.Count == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Name == "Test2Direction");
		}
예제 #19
0
		public void TestFirefightingZone()
		{
			var device = AddDevice(kauDevice, GKDriverType.RSR2_HandDetector);
			var zone = new GKZone();
			GKManager.Zones.Add(zone);
			device.ZoneUIDs.Add(zone.UID);
			var direction = new GKDirection();
			GKManager.AddDirection(direction);
			TestFirefightingZone(zone, direction);
		}
예제 #20
0
		public void AddIdenticalDirectionTest()
		{
			var direction = new GKDirection()
			{
				No = 1,
				Name = "Test 1 Direction"
			};
			GKManager.AddDirection(direction);
			CreateGroupControllerModule();
			MockDialogService.OnShowModal += x =>
			{
				(x as DirectionDetailsViewModel).No = 1;
				(x as DirectionDetailsViewModel).Name = "Test Direction";
				(x as DirectionDetailsViewModel).SaveCommand.Execute();
			};
			var directionsViewModel = GroupControllerModule.DirectionsViewModel;
			directionsViewModel.OnShow();
			Assert.IsTrue(directionsViewModel.Directions.Count == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Name.CompareTo("Test 1 Direction") == 0);
			directionsViewModel.AddCommand.Execute();
			Assert.IsTrue(directionsViewModel.Directions.Count == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Name == "Test 1 Direction");
		}
예제 #21
0
		/// <summary>
		/// Изменение логики направления
		/// </summary>
		/// <param name="direction"></param>
		/// <param name="logic"></param>
		public static void SetDirectionLogic(GKDirection direction, GKLogic logic)
		{
			direction.Logic = logic;
			direction.ChangedLogic();
		}
예제 #22
0
		/// <summary>
		/// Изменение направления
		/// </summary>
		/// <param name="direction"></param>
		public static void EditDirection(GKDirection direction)
		{
			direction.OutputDependentElements.ForEach(x => x.OnChanged());
			direction.OnChanged();
		}
예제 #23
0
		/* RG-1015 (Если у направления задан Режим после удержания "Включено", то после окончания отсчета удержания оно не должено переходить в режим "Включается")*/
		public void TestDelayRegimeDirection(DelayRegime regime, XStateClass state)
		{
			var direction = new GKDirection { Name = "Направление", No = 1 };

			var zone = new GKZone { Name = "Пожарная зона", No = 1 };
			var clause = new GKClause
			{
				ClauseOperationType = ClauseOperationType.AllZones,
				StateType = GKStateBit.Fire1,
				ZoneUIDs = { zone.UID }
			};
			var device1 = AddDevice(kauDevice11, GKDriverType.RSR2_HeatDetector);
			var device2 = AddDevice(kauDevice11, GKDriverType.RSR2_HeatDetector);
			var device3 = AddDevice(kauDevice11, GKDriverType.RSR2_HeatDetector);
			direction.Logic.OnClausesGroup.Clauses.Add(clause);
			direction.Delay = 3;
			direction.Hold = 3;
			direction.DelayRegime = regime;
			GKManager.AddZone(zone);
			GKManager.AddDirection(direction);
			GKManager.AddDeviceToZone(device1, zone);
			GKManager.AddDeviceToZone(device2, zone);
			GKManager.AddDeviceToZone(device3, zone);
			SetConfigAndRestartImitator();

			WaitWhileState(zone, XStateClass.Norm, 10000, "Ждем Норму в зоне");
			Assert.IsTrue(zone.State.StateClass == XStateClass.Norm, "Проверка того, что зона в Норме");
			ConrtolGKBase(device1, GKStateBit.Fire1, "Сработка1 у датчика1");
			ConrtolGKBase(device2, GKStateBit.Fire1, "Сработка1 у датчика2");
			WaitWhileState(direction, XStateClass.On, 5000, "Ждем пока направление не Включится");
			Assert.IsTrue(direction.State.StateClass == XStateClass.On, "Проверка того, что направление Включено");
			WaitWhileState(direction, XStateClass.TurningOn, 6000, "Ждем 6 секунд, направление не должено перейти в режим Включается");
			Assert.IsFalse(direction.State.StateClass == XStateClass.TurningOn, "Проверка того, что направление не перешло в режим Включается");
			Assert.IsTrue(direction.State.StateClass == state, "Проверка того, что направление Включено/Выключено");
/*			if (direction.DelayRegime == DelayRegime.On)
				CheckJournal(4, JournalItem(direction, JournalEventNameType.Включается),
							JournalItem(Led("Устройство Включение ПУСК "), JournalEventNameType.Включено), JournalItem(Led("Устройство Пожар 1 "), JournalEventNameType.Включено),
							JournalItem(direction, JournalEventNameType.Включено)); 
			else
				CheckJournal(6, JournalItem(direction, JournalEventNameType.Включается),
					JournalItem(Led("Устройство Включение ПУСК "), JournalEventNameType.Включено), JournalItem(Led("Устройство Пожар 1 "), JournalEventNameType.Включено),
					JournalItem(direction, JournalEventNameType.Включено), JournalItem(direction, JournalEventNameType.Выключено), JournalItem(Led("Устройство Пожар 1 "), JournalEventNameType.Выключено));
RG-1340*/
		}
예제 #24
0
		public void EditDirectionPropertiesTest()
		{
			var direction = new GKDirection()
			{
				No = 1,
				Name = "Test Direction Properties",
				Description = "Примечание",
				Delay = 15,
				Hold = 14,
				DelayRegime = DelayRegime.Off,
			};
			GKManager.AddDirection(direction);
			CreateGroupControllerModule();

			MockDialogService.OnShowModal += x =>
			{
				(x as DirectionDetailsViewModel).Name = "Test Edit Direction Properties";
				(x as DirectionDetailsViewModel).Description = "Удалено";
				(x as DirectionDetailsViewModel).No = 2;
				(x as DirectionDetailsViewModel).Delay = 1;
				(x as DirectionDetailsViewModel).Hold = 2;
				(x as DirectionDetailsViewModel).DelayRegime = DelayRegime.On;
				(x as DirectionDetailsViewModel).SaveCommand.Execute();
			};
			var directionsViewModel = GroupControllerModule.DirectionsViewModel;
			directionsViewModel.OnShow();
			Assert.IsTrue(directionsViewModel.Directions.Count == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.No == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Name == "Test Direction Properties");
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Delay == 15);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Hold == 14);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.DelayRegime == DelayRegime.Off);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Description == "Примечание");
			directionsViewModel.EditCommand.Execute();
			Assert.IsTrue(directionsViewModel.Directions.Count == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.No == 2);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Name == "Test Edit Direction Properties");
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Delay == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Hold == 2);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.DelayRegime == DelayRegime.On);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.Description == "Удалено");
		}
예제 #25
0
		public void RemoveDeviceTestLogicForDelayAndDirection()
		{
			var device = AddDevice(kauDevice11, GKDriverType.RSR2_MDU);
			GKManager.UpdateConfiguration();

			var clause = new GKClause
			{
				ClauseOperationType = ClauseOperationType.AllDevices,
				DeviceUIDs = { device.UID }
			};

			var gkLogic = new GKLogic();
			gkLogic.OnClausesGroup.Clauses.Add(clause);

			GKManager.SetDeviceLogic(device, gkLogic);
			Assert.IsTrue(device.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsFalse(device.OutputDependentElements.Any(x => x.UID == device.UID));
			Assert.IsFalse(device.InputDependentElements.Any(x => x.UID == device.UID));

			var delay = new GKDelay();
			GKManager.AddDelay(delay);
			GKManager.SetDelayLogic(delay, gkLogic);
			Assert.IsTrue(delay.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsTrue(device.OutputDependentElements.Any(x => x.UID == delay.UID));
			Assert.IsTrue(delay.InputDependentElements.Any(x => x.UID == device.UID));

			var direction = new GKDirection();
			GKManager.AddDirection(direction);
			GKManager.SetDirectionLogic(direction,gkLogic);
			Assert.IsTrue(direction.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Any()));
			Assert.IsTrue(device.OutputDependentElements.Any(x => x.UID == direction.UID));
			Assert.IsTrue(direction.InputDependentElements.Any(x => x.UID == device.UID));

			GKManager.RemoveDevice(device);
			Assert.IsFalse(delay.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsFalse(direction.Logic.OnClausesGroup.Clauses.Any(x => x.DeviceUIDs.Contains(device.UID)));
			Assert.IsFalse(delay.InputDependentElements.Any(x => x.UID == device.UID));
			Assert.IsFalse(direction.InputDependentElements.Any(x => x.UID == device.UID));

		}
예제 #26
0
		public void TestDirection()
		{
			var direction = new GKDirection();
			GKManager.AddDirection(direction);
			Test(direction, GKDriverType.DirectionsMirror);
		}
예제 #27
0
		public void CopyDirectionTest()
		{
			var direction = new GKDirection()
			{
				No = 3,
			};
			GKManager.AddDirection(direction);
			CreateGroupControllerModule();

			var directionsViewModel = GroupControllerModule.DirectionsViewModel;
			directionsViewModel.OnShow();
			Assert.IsTrue(directionsViewModel.Directions.Count == 1);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.No == 3);
			directionsViewModel.CopyCommand.Execute();
			directionsViewModel.PasteCommand.Execute();
			Assert.IsTrue(directionsViewModel.Directions.Count == 2);
			Assert.IsTrue(directionsViewModel.SelectedDirection.Direction.No == 4);
		}
예제 #28
0
		public void TestDependencyChainToGK()
		{
			var device1 = AddDevice(kauDevice1, GKDriverType.RSR2_HandDetector);
			var device2 = AddDevice(kauDevice2, GKDriverType.RSR2_HandDetector);

			var direction1 = new GKDirection();
			direction1.Logic.OnClausesGroup.Clauses.Add(new GKClause() { ClauseOperationType = ClauseOperationType.AllDevices, StateType = GKStateBit.Fire1, DeviceUIDs = { device1.UID, device2.UID } });
			GKManager.Directions.Add(direction1);

			var direction2 = new GKDirection();
			direction2.Logic.OnClausesGroup.Clauses.Add(new GKClause() { ClauseOperationType = ClauseOperationType.AllDirections, StateType = GKStateBit.On, DirectionUIDs = { direction1.UID } });
			GKManager.Directions.Add(direction2);

			var direction3 = new GKDirection();
			direction3.Logic.OnClausesGroup.Clauses.Add(new GKClause() { ClauseOperationType = ClauseOperationType.AllDirections, StateType = GKStateBit.On, DirectionUIDs = { direction2.UID } });
			GKManager.Directions.Add(direction3);

			var direction4 = new GKDirection();
			direction4.Logic.OnClausesGroup.Clauses.Add(new GKClause() { ClauseOperationType = ClauseOperationType.AllDirections, StateType = GKStateBit.On, DirectionUIDs = { direction3.UID } });
			GKManager.Directions.Add(direction4);

			var direction5 = new GKDirection();
			direction5.Logic.OnClausesGroup.Clauses.Add(new GKClause() { ClauseOperationType = ClauseOperationType.AllDirections, StateType = GKStateBit.On, DirectionUIDs = { direction4.UID } });
			GKManager.Directions.Add(direction5);
			Compile();

			CheckObjectLogicOnGK(direction1);
			CheckObjectLogicOnGK(direction2);
			CheckObjectLogicOnGK(direction3);
			CheckObjectLogicOnGK(direction4);
			CheckObjectLogicOnGK(direction5);
		}
예제 #29
0
		public ObjectViewModel(GKDirection direction)
		{
			Direction = direction;
			Name = direction.PresentationName;
			ImageSource = "/Controls;component/Images/Blue_Direction.png";
			Address = "";
			PresentationZoneOrLogic = GKManager.GetPresentationLogic(direction.Logic);
			ObjectType = ObjectType.Direction;
			SortingName = "c " + direction.No;
		}
예제 #30
0
		public void DeleteDirectionTest()
		{
			MockMessageBoxService.ShowConfirmationResult = true;
			var direction = new GKDirection();
			GKManager.AddDirection(direction);
			CreateGroupControllerModule();
			var directionsViewModel = GroupControllerModule.DirectionsViewModel;
			directionsViewModel.OnShow();
			Assert.IsTrue(directionsViewModel.Directions.Count == 1);
			directionsViewModel.DeleteCommand.Execute();
			Assert.IsTrue(directionsViewModel.Directions.Count == 0);
		}