Пример #1
0
		public PimDescriptor(XPim pim)
		{
			DatabaseType = DatabaseType.Gk;
			DescriptorType = DescriptorType.Pim;
			Pim = pim;
			Build();
		}
Пример #2
0
		public PimViewModel(XPim pim)
		{
			ShowJournalCommand = new RelayCommand(OnShowJournal);
			ShowPropertiesCommand = new RelayCommand(OnShowProperties);
			Pim = pim;
			State.StateChanged += new System.Action(OnStateChanged);
			OnStateChanged();
		}
Пример #3
0
		public void AddPim(XPim pim)
		{
			if (!Pims.Contains(pim))
			{
				pim.GKDescriptorNo = NextDescriptorNo;
				pim.GkDatabaseParent = RootDevice;
				Pims.Add(pim);
			}
		}
Пример #4
0
		public PimDetailsViewModel(XPim pim)
		{
			Pim = pim;
			State.StateChanged += new Action(OnStateChanged);

			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);

			Title = Pim.Name;
			TopMost = true;
		}
Пример #5
0
		public XPimState(XPim pim)
		{
			Pim = pim;
		}
Пример #6
0
		public ArchivePimViewModel(XPim pim)
		{
			Pim = pim;
			Name = pim.PresentationName;
		}
Пример #7
0
		void InitializeFromObjectUID()
		{
			if (JournalItem.GKObjectNo != 0)
			{
				Device = XManager.Devices.FirstOrDefault(x => x.GKDescriptorNo == JournalItem.GKObjectNo);
				if (Device != null)
				{
					JournalItem.JournalItemType = JournalItemType.Device;
					JournalItem.ObjectUID = Device.UID;
					JournalItem.ObjectName = Device.DottedPresentationAddress + Device.ShortName;
				}
				Zone = XManager.Zones.FirstOrDefault(x => x.GKDescriptorNo == JournalItem.GKObjectNo);
				if (Zone != null)
				{
					JournalItem.JournalItemType = JournalItemType.Zone;
					JournalItem.ObjectUID = Zone.UID;
					JournalItem.ObjectName = Zone.PresentationName;
				}
				Direction = XManager.Directions.FirstOrDefault(x => x.GKDescriptorNo == JournalItem.GKObjectNo);
				if (Direction != null)
				{
					JournalItem.JournalItemType = JournalItemType.Direction;
					JournalItem.ObjectUID = Direction.UID;
					JournalItem.ObjectName = Direction.PresentationName;
				}
				PumpStation = XManager.PumpStations.FirstOrDefault(x => x.GKDescriptorNo == JournalItem.GKObjectNo);
				if (PumpStation != null)
				{
					JournalItem.JournalItemType = JournalItemType.PumpStation;
					JournalItem.ObjectUID = PumpStation.UID;
					JournalItem.ObjectName = PumpStation.PresentationName;
				}
				Delay = XManager.Delays.FirstOrDefault(x => x.GKDescriptorNo == JournalItem.GKObjectNo);
				if (Delay != null)
				{
					JournalItem.JournalItemType = JournalItemType.Delay;
					JournalItem.ObjectUID = Delay.UID;
					JournalItem.ObjectName = Delay.PresentationName;
				}
				Pim = XManager.Pims.FirstOrDefault(x => x.GKDescriptorNo == JournalItem.GKObjectNo);
				if (Pim != null)
				{
					JournalItem.JournalItemType = JournalItemType.Pim;
					JournalItem.ObjectUID = Pim.UID;
					JournalItem.ObjectName = Pim.PresentationName;
				}
			}
		}
Пример #8
0
		void CreatePim()
		{
			Pim = new XPim()
			{
				Name = PumpStation.PresentationName
			};
			Pim.UID = GuidHelper.CreateOn(PumpStation.UID);
			GkDatabase.AddPim(Pim);
			var pimDescriptor = new PimDescriptor(Pim);
			GkDatabase.Descriptors.Add(pimDescriptor);

			var formula = new FormulaBuilder();

			var inputDevices = new List<XBase>();
			inputDevices.AddRange(PumpStation.InputDevices);
			foreach (var nsDevice in PumpStation.NSDevices)
			{
				if (!inputDevices.Contains(nsDevice))
					inputDevices.Add(nsDevice);
			}
			foreach (var inputDevice in inputDevices)
			{
				UpdateConfigurationHelper.LinkXBases(Pim, inputDevice);
			}
			for (int i = 0; i < inputDevices.Count; i++)
			{
				var nsDevice = inputDevices[i];
				formula.AddGetBit(XStateBit.Failure, nsDevice);
				if (i > 0)
				{
					formula.Add(FormulaOperationType.OR);
				}
			}
			formula.AddPutBit(XStateBit.Failure, Pim);

			formula.Add(FormulaOperationType.END);
			pimDescriptor.Formula = formula;
			pimDescriptor.FormulaBytes = formula.GetBytes();
		}