XPS Unified Programmer’s Manual
3.3 How to Use XPS .NET Assembly from Visual Studio C#?
Refer to Microsoft for more information on how to load and use a .NET assembly
depending on your Visual Studio version.
3.3.1 Add Reference to Newport XPS .NET Assembly
In your project add Newport.XPS.CommandInterface.dll in References from Windows
GAC:
3.3.2 C# Code Sources
C# Header
using CommandInterfaceXPS; // Newport.XPS.CommandInterface .NET Assembly
access
Add a Variable to Declare an “XPS” Object
CommandInterfaceXPS.XPS m_xpsInterface = null;
Create an Instance of “XPS” Object
m_xpsInterface = new CommandInterfaceXPS.XPS();
if (m_xpsInterface != null)
…
Open XPS Connection
if (m_xpsInterface != null)
int returnValue = m_xpsInterface.OpenInstrument(m_IPAddress, m_IPPort,
DEFAULT_TIMEOUT);
Call “XPS” Functions
if (m_xpsInterface != null)
{
string XPSVersion = string.Empty;
string errorString = string.Empty;
int result = m_xpsInterface.FirmwareVersionGet(out XPSVersion, out
errorString);
if (result == CommandInterfaceXPS.XPS.FAILURE)
...
EDH0373En1023 — 01/18 6