public void Add(ImitatorJournalItem imitatorJournalItem)
		{
			try
			{
				imitatorJournalItem.GkNo = Context.ImitatorJournalItems.Count() + 1;
				imitatorJournalItem.DateTime = imitatorJournalItem.DateTime.CheckDate();
				Context.ImitatorJournalItems.Add(imitatorJournalItem);
				Context.SaveChanges();
			}
			catch
			{

			}
		}
		void OnShowParameters()
		{
			SaveCancelDialogViewModel propertiesViewModel = null;
			if (GKBase is GKDevice)
			{
				propertiesViewModel = new DevicePropertiesViewModel(GKBase as GKDevice);
			}
			if (GKBase is GKDirection)
			{
				propertiesViewModel = new DirectionPropertiesViewModel(GKBase as GKDirection);
			}
			if (GKBase is GKDelay)
			{
				propertiesViewModel = new DelayPropertiesViewModel(GKBase as GKDelay);
			}
			if (GKBase is GKGuardZone)
			{
				propertiesViewModel = new GuardZonePropertiesViewModel(GKBase as GKGuardZone);
			}
			if (GKBase is GKDoor)
			{
				propertiesViewModel = new DoorPropertiesViewModel(GKBase as GKDoor);
			}
			if (GKBase is GKPumpStation)
			{
				propertiesViewModel = new PumpStationPropertiesViewModel(GKBase as GKPumpStation);
			}
			if (GKBase is GKMPT)
			{
				propertiesViewModel = new MPTPropertiesViewModel(GKBase as GKMPT);
			}
			if (GKBase is GKCode)
			{
				propertiesViewModel = new CodePropertiesViewModel(GKBase as GKCode);
			}

			if (propertiesViewModel != null && DialogService.ShowModalWindow(propertiesViewModel))
			{
				var journalItem = new ImitatorJournalItem(2, 13, 0, 0);
				AddJournalItem(journalItem);
			}

			InitializeDelays();
		}
		void OnEnterUser()
		{
			var journalItem = new ImitatorJournalItem(0, 7, 0, 0);
			AddJournalItem(journalItem);
		}
		void OnGoToWorkingRegime()
		{
			var journalItem = new ImitatorJournalItem(0, 6, 0, 0);
			AddJournalItem(journalItem);
		}
		void OnGoToTechnoligicalRegime()
		{
			var journalItem = new ImitatorJournalItem(0, 0, 0, 0);
			AddJournalItem(journalItem);
		}
		void OnResetDustiness()
		{
			var journalItem = new ImitatorJournalItem(2, 7, 0, 0);
			AddJournalItem(journalItem);
		}
		void OnSetCriticalDustiness()
		{
			var journalItem = new ImitatorJournalItem(2, 7, 2, 1);
			AddJournalItem(journalItem);
		}
		void OnSetPreDustiness()
		{
			var journalItem = new ImitatorJournalItem(2, 7, 1, 1);
			AddJournalItem(journalItem);
		}
		void OnSetFireTemperatureGradient()
		{
			var journalItem = new ImitatorJournalItem(2, 2, 4, 0);
			SetStateBit(GKStateBit.Fire1, true, journalItem);
		}
		void OnTestLaser()
		{
			var journalItem = new ImitatorJournalItem(2, 6, 2, 1);
			SetStateBit(GKStateBit.Test, true, journalItem);
		}
		void OnTestButton()
		{
			var journalItem = new ImitatorJournalItem(2, 6, 1, 1);
			SetStateBit(GKStateBit.Test, true, journalItem);
		}
		public void SetParameters(List<byte> bytes)
		{
			var properties = GetPropertiesFromBytes(bytes);
			var device = GKBaseDescriptor.GKBase as GKDevice;
			if (device != null)
			{
				device.Properties = properties;
			}

			var direction = GKBaseDescriptor.GKBase as GKDirection;
			if (direction != null)
			{
				if (properties.Count >= 3)
				{
					direction.Delay = properties[0].Value;
					direction.Hold = properties[1].Value;
					direction.DelayRegime = (DelayRegime)properties[2].Value;
				}
			}

			var delay = GKBaseDescriptor.GKBase as GKDelay;
			if (delay != null)
			{
				if (properties.Count >= 3)
				{
					delay.DelayTime = properties[0].Value;
					delay.Hold = properties[1].Value;
					delay.DelayRegime = (DelayRegime)properties[2].Value;
				}
			}

			var pumpStation = GKBaseDescriptor.GKBase as GKPumpStation;
			if (pumpStation != null)
			{
				if (properties.Count >= 3)
				{
					pumpStation.Delay = properties[0].Value;
					pumpStation.Hold = properties[1].Value;
					pumpStation.DelayRegime = (DelayRegime)properties[2].Value;
				}
			}

			var door = GKBaseDescriptor.GKBase as GKDoor;
			if (door != null)
			{
				if (properties.Count >= 3)
				{
					door.Delay = properties[0].Value;
					door.Hold = properties[1].Value;
				}
			}

			var guardZone = GKBaseDescriptor.GKBase as GKGuardZone;
			if (guardZone != null)
			{
				if (properties.Count >= 3)
				{
					guardZone.SetDelay = properties[0].Value;
					guardZone.ResetDelay = properties[1].Value;
					guardZone.AlarmDelay = properties[2].Value;
				}
			}

			var journalItem = new ImitatorJournalItem(2, 13, 0, 0);
			AddJournalItem(journalItem);
		}
		void OnSetFireHandDetector()
		{
			var journalItem = new ImitatorJournalItem(2, 3, 1, 0);
			SetStateBit(GKStateBit.Fire2, true, journalItem);
		}
		void OnExitUser()
		{
			var journalItem = new ImitatorJournalItem(0, 8, 0, 0);
			AddJournalItem(journalItem);
		}
		void OnResetTest()
		{
			var journalItem = new ImitatorJournalItem(2, 6, 0, 0);
			SetStateBit(GKStateBit.Test, false, journalItem);
		}
		public void SynchronyzeDateTime()
		{
			var journalItem = new ImitatorJournalItem(0, 2, 0, 0);
			AddJournalItem(journalItem);
		}
		void OnSetFireSmoke()
		{
			var journalItem = new ImitatorJournalItem(2, 2, 2, 0);
			SetStateBit(GKStateBit.Fire1, true, journalItem);
		}