Microsoft .NET Languages (C#, J#, VB .NET, C++ .NET)

Integration

For .NET applications, SeaMAX includes a CLR component which encapsulates the SeaMAX Application Programmer's Interface across any .NET project. The project must be configured properly to reference the .NET assembly and deploy the native library.

.NET Framework Version

The SeaMAX .NET Assembly is a class library designed using version 2.0 of the .NET framework. Since SeaMAX targets this fundamental version, it is compatible with all subsequent versions of the framework. SeaMAX will always run under the application target framework version.

Assembly Reference

A .NET project must reference the SeaMAX .NET assembly located in the SeaMAX API install path ("Program Files\Sealevel Systems\SeaMAX\" or "Program Files (x86)\Sealevel Systems\SeaMAX\"). This can be accomplished by the following:

  1. Choose 'Project->Add Reference...' from the menu bar in Visual Studio
    managed_seamax_1.png
    Figure 1: Add Reference...
  2. Click the 'Browse...' button, and navigate to the SeaMAX installation library path
    ('Library\32-bit' or 'Library\64-bit' depending on the target platform)
    managed_seamax_2.png
    Figure 2: SeaMAX Dot NET Assembly
  3. Click 'OK' to save changes

Deploy Native DLL

The .NET SeaMAX Assembly depends on the native SeaMAX.dll. The project can be configured to automatically deploy the native DLL at build time. This can be accomplished by the following:

  1. Right click the project, and select 'Add->Existing Item' from the context menu
    managed_seamax_3.png
    Figure 3: Add Existing Item
  2. Navigate to the SeaMAX installation library path
    ('Library\32-bit' or 'Library\64-bit' depending on the target platform)
  3. Select the file SeaMAX.dll (it may be necessary to change the filter drop-down to 'Executable Files')
  4. From the Solution Explorer, right click the SeaMAX.dll file, and click 'Properties'
    managed_seamax_4.png
    File Properties
  5. Set the 'Copy to Output Directory' option to 'Copy if newer'

Integrated Documentation

Visual Studio IntelliSense documentation is included. The documentation can be accessed in-line from the source editor whenever a member of the Sealevel namespace is accessed. Additionally, the Object Browser built into Visual Studio can be used to examine every class and member in the namespace.

managed_seamax_5.png
Figure 5: Integrated Documentation

Example

The managed SeaMAX .NET component encapsulates SeaMAX into the Sealevel namespace. The methods provided in the .NET SeaMAX class conform to the SeaMAX API as documented, with the exception that the SeaMAX handle is concealed as a private variable within the class and is automatically created and destroyed. The following is an example of how to call SM_Open() and SM_Close() within a C# project after adding the Managed SeaMAX reference:

Sealevel.SeaMAX sm = new Sealevel.SeaMAX();

if (sm.SM_Open("COM1") < 0)
{
  // Error opening COM1
}

if (sm.IsSeaMAXOpen)
{
  sm.SM_Close();
}
 
 
Generated on Mon Nov 26 2018.