Differences

This shows you the differences between two versions of the page.

Link to this comparison view

muster:9.0:api:dotnet [2018/01/10 14:01] (current)
Line 1: Line 1:
 +======= Muster .Net API =======
  
 +Before reading this section, please look at the [[muster:​9.0:​api:​scripting_guidelines|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:
 +
 +<code asp>
 +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();​
 +             
 +        }
 +    }
 +}
 +
 +</​code>​