Muster .Net API

Before reading this section, please look at the Bindings guidelines for the setup common to the bindings.

The .NET API requires you to import all the .cs files distributed with the SDK (sdk/libs/platform) inside your project. The .NET API does not require any additional configuration.

You do not need to import any module from a .NET project, you just need to make sure the following files are available into your compiled program directory:

  • MClientAPI.dll (from the .NET SDK libs folder)
  • MTemplateAPI.dll (from the .NET SDK libs folder)
  • MBase.dll
  • MClientLib.dll
  • MFramework.dll
  • MTemplate.dll

If you're working with Mono on a Unix platform, just use the .so or .dylib files instead of the .DLL files. The usage steps remains the same as the ones on the Windows platform.

This is a typical example that pauses JOB ID 1:

using System;
using System.Text;
 
namespace ConsoleApplication
{
    class Program
    {
        static void Main(string[] args)
        {
 
            MClientAPI.InitializeLibrary(string.Empty);
            var session = MClientAPI.InitializeSession();
            var err = MClientAPI.Connect(session, "127.0.0.1", 9780);
            if (err.getErrorCode() != 0)
            {
                Console.WriteLine("Failed to connect to the Dispatcher service!");
                MClientAPI.ShutdownLibrary();
                return;
            }
 
            MClientAPI.JobActionPause(session, 1);
            MClientAPI.Disconnect(session);
            MClientAPI.ShutdownLibrary();
 
        }
    }
}