How to...

Glue42 Enable Your App

.NET

Referencing

To use any Glue42 Desktop functionality, you need to reference the Glue42 .NET library (either as a standalone Glue42.dll file or from as a NuGet package), instantiate and initialize a class called Glue42, which provides access to the different Glue42 Desktop functionalities.

As a NuGet Pacakge

The Glue42 .NET library is available as a NuGet package which you can include and configure in your projects.

<packages>
    <package id="Glue42" version="2018.2084.0" targetFramework="net45" />
</packages> 

NuGet Package

As a Standalone File

Another option is to reference the Glue42.dll - the file is delivered with the Glue42 Desktop installer and is located in %LOCALAPPDATA%\Tick42\GlueSDK\Glue42NET\lib\net45\Glue42.dll (you can alternatively use the .nupkg package located in %LOCALAPPDATA%\Tick42\GlueSDK\Glue42NET);

<Reference Include="Glue42">
    <HintPath>..\lib\Glue42.dll</HintPath>
</Reference>

Initialization

To initialize the Glue42 .NET library, the only required parameter is the application name, which will be used to identify your app across different services like Interop, Metrics:

// using Tick42
var applicationName = "DemoApp";
var glue = new Glue42();
glue.Initialize(applicationName);

Registering Your Application

To add your .NET application to the Glue42 Desktop Application Manager, you need to define a .json configuration file and add it to the application config store. You can add an application configuration file in the %LocalAppData%\Tick42\UserData\<REG-ENV>\apps folder to publish your own application locally. <REG-ENV> in the link should be replaced with the region and environment folder name used for the deployment of your Glue42 Desktop - e.g., T42-DEMO. This way, your files will not be erased or overwritten, in case you decide to upgrade or change your Glue42 Desktop version.

Application configuration example:

{
    "title": "Client List WPF v1",
    "type": "exe",
    "name": "cl-wpf1",
    "icon": "https://enterprise-demos.tick42.com/resources/icons/w1.jpg",
    "details": {
        "path": "%GDDIR%/../Demos/ClientProfileDemo/",
        "command": "ClientProfileDemo.exe",
        "parameters": " --mode=1"
    }
}
  • type should be exe;
  • path is the path to the executable. It can be relative or absolute. You can also use the %GDDIR% env var, which points to the Glue42 Desktop install folder;
  • command is the actual command to execute (the .exe file name);
  • parameters holds command line arguments passed to the executable;

Note that the definition should be a valid .json file (you should either use forward slash or escape the backslash).

For more detailed information about the application definitions, see the Configuration documentation.

You can also check out our .NET examples at GitHub, demonstrating the various Glue42 Desktop features.

Glue42 ClickOnce

Glue42 Desktop offers support for ClickOnce applications. Below you can see how to initialize the Glue42 .NET library in your ClickOnce application and how to register a ClickOnce application in Glue42 Desktop.

Initialization

In a ClickOnce application, the Glue42 .NET library is initialized asynchronously with an optional InitializeOptions object, in which you can specify what Glue42 features you want your application to use.

Here is an example initialization:

var initializeOptions = new InitializeOptions()
    {
        ApplicationName = "ClientProfileDemo", 
        IncludedFeatures = GDFeatures.UseAppManager | GDFeatures.UseGlueWindows
    };

// the initialization options are not required; 
// if skipped, Glue42 will be initialized with the default options 
// (default assembly name for ApplicationName and with all features included)

Glue42 glue;
Glue42.InitializeGlue(initializeOptions) 
                .ContinueWith(glueInit =>
                    {
                        glue = glueInit.Result;
                        // use glue here
                    });

You can also set methods for saving and restoring the state of your Glue42 enabled ClickOnce application:

initializeOptions.SetSaveRestoreStateEndpoint(GetState, RestoreState);

GetState and RestoreState are user defined methods for what information about the ClickOnce application state to save and later restore.

Registering a ClickOnce Application

To show your ClickOnce application in the Application Manager of Glue42 Desktop, you need to create a configuration .json file and add it to the application configuration store.

Here is an example configuration for a ClickOnce application:

{        
    "title": "Client List - ClickOnce",
    "type": "clickonce",
    "name": "cl-clickonce",
    "hidden": false,
    "details": {
        "url": "http://localhost:9091/ClickOnceClientProfileDemo.application",
        "width": 1000,
        "height": 400
    },
    "customProperties": {
        "selectedClient": "john",
        "darkThemeOn": true
    }
}
  • type - should be clickonce;
  • url - the web address pointing to the physical location where the ClickOnce application is deployed and from where it will be installed on the user machine;
  • customProperties - application context with custom parameters your application can access at runtime through glue.GDStartingContext.ApplicationConfig.CustomProperties["propertyName"];

Glue42 Silverlight

We offer a Glue42 Silverlight library as a version of the Glue42 .NET library. Glue42 Silverlight offers the same features and functionalities as the Glue42 .NET library, it is only tailored to meet the specifications of the MS Silverlight framework.