public PimDescriptor(XPim pim) { DatabaseType = DatabaseType.Gk; DescriptorType = DescriptorType.Pim; Pim = pim; Build(); }
public PimViewModel(XPim pim) { ShowJournalCommand = new RelayCommand(OnShowJournal); ShowPropertiesCommand = new RelayCommand(OnShowProperties); Pim = pim; State.StateChanged += new System.Action(OnStateChanged); OnStateChanged(); }
public void AddPim(XPim pim) { if (!Pims.Contains(pim)) { pim.GKDescriptorNo = NextDescriptorNo; pim.GkDatabaseParent = RootDevice; Pims.Add(pim); } }
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; }
public XPimState(XPim pim) { Pim = pim; }
public ArchivePimViewModel(XPim pim) { Pim = pim; Name = pim.PresentationName; }
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; } } }
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(); }