Glue42 Notification Service

.NET

Raising a Notification

The Glue42 Notification Service API can be accessed through the Notifications property of the Glue object:

var notification = new DesktopNotification("Hello from Glue42",
    NotificationSeverity.Low,
    "type",
    Description.Text,
    "category",
    "source"
);

App.Glue.Notifications.Publish(notification);

Simple notification

See our .NET Notifications example on GitHub.

Notification Click

When raising a notification, you can specify what happens when the user clicks on the notification. By default, this will show the built-in notification details view, but you can replace that with invoking an Interop method. To do this, add a GlueRoutingDetailMethodName parameter to your Notification object. In the following example, clicking on the notification will invoke the DetailsHandler Interop method:

var notification = new DesktopNotification(Title.Text,
    NotificationSeverity.Low,
    "type",
    Description.Text,
    "category",
    "source",
    "DetailsHandler"      
);

Actions

Notifications may contain actions (usually displayed as buttons in the UI) that the user can execute when they see the notification. Executing an action results in invoking an Interop method. This Interop method can be registered by the publisher of the notification or any other application that can handle the action. The handler of the Interop action can also receive parameters, specified by the publisher of the notification.

In the following example, we add actions Accept and Reject passing a customerId parameter to the action handlers:

var parameters = new List<GlueMethodParameter>()
{
    new GlueMethodParameter("customerId", new GnsValue("11"))
};

var actions = new List<GlueRoutingMethod>()
{
    new GlueRoutingMethod("AcceptNotification", Description: "accept", Parameters: parameters),
    new GlueRoutingMethod("RejectNotification", Description: "reject", Parameters: parameters)
};

var notification = new DesktopNotification(Title.Text,
    NotificationSeverity.Low,
    "type",
    Description.Text,
    "category",
    "source",
    "DetailsHandler",              
    actions
);

Notification with actions

Custom Notification UI

You can change the default notification UI by changing the GNS application configuration:

  • if you are running in local mode, go to %LOCALAPPDATA%\Tick42\GlueDesktop\config\apps\gns.json
  • find the GNS application;
  • add a customProperties section (or update the existing one):
"customProperties": {
    "toastUrl": "https://enterprise-demos.tick42.com/gns-custom-toasts/",
    "width": 250,
    "height": 125,
    "count": 3
}

Notification with actions

Example

You can check out the Glue42 Notification Service example in our Glue42 .NET examples repository at GitHub (notifications folder).