Using Predefined or Custom Values for Source and Output Terminal Properties

How Do I Pass a Predefined Value to an NI-DCPower Property?

There are certain properties, such as trigger sources and trigger and event output terminals, that work with a set of predefined string values, but might also accept custom values. For this you can use the utility classes that are part of NI-DCPower .NET API. For example, the InputTerminal property specifies a DCPowerDigitalEdgeSourceTriggerInputTerminal object. You can configure InputTerminal using one of the predefined values, such as:

VB.NET

dcPowerSession.Triggers.MeasureTrigger.DigitalEdge.InputTerminal = DCPowerDigitalEdgeMeasureTriggerInputTerminal.PxiTriggerLine0
C# 

dcPowerSession.Triggers.MeasureTrigger.DigitalEdge.InputTerminal = DCPowerDigitalEdgeMeasureTriggerInputTerminal.PxiTriggerLine0;

You can also create a custom value with the static FromString method:

VB.NET

dcPowerSession.Triggers.MeasureTrigger.DigitalEdge.InputTerminal = DCPowerDigitalEdgeMeasureTriggerInputTerminal.FromString("CustomInputTerminal")
C#

dcPowerSession.Triggers.MeasureTrigger.DigitalEdge.InputTerminal = DCPowerDigitalEdgeMeasureTriggerInputTerminal.FromString("CustomInputTerminal");

You can also directly set the source as a string instead of using the FromString method:

VB.NET

dcPowerSession.Triggers.MeasureTrigger.DigitalEdge.InputTerminal = "CustomInputTerminal"
C#

dcPowerSession.Triggers.MeasureTrigger.DigitalEdge.InputTerminal = "CustomInputTerminal";

How Do I Get the Underlying String from Source or Output Terminal Value?

You can use the ToString method to retrieve the underlying source values. For example, the following code shows how to retrieve the source name:

VB.NET

Dim triggerInputTerminal As String = DCPowerDigitalEdgeMeasureTriggerInputTerminal.PxiTriggerLine0.ToString()
C#

string triggerInputTerminal = DCPowerDigitalEdgeMeasureTriggerInputTerminal.PxiTriggerLine0.ToString();

You can use the underlying string value to assign a source or output terminal to some other source or output terminal.

VB.NET

dcPowerSession1.Events.MeasureCompleteEvent.OutputTerminal = DCPowerMeasureCompleteEventOutputTerminal.PxiTriggerLine0
C#

dcPowerSession1.Events.MeasureCompleteEvent.OutputTerminal = DCPowerMeasureCompleteEventOutputTerminal.PxiTriggerLine0;