LaunchBoxCONTRIBUTORS
On this page

14.1 Beta 1 SDK

This reference documents the current beta SDK. Beta APIs can change before stable.

INotificationManager14.1 Beta

C#
public interface Unbroken.LaunchBox.Plugins.Notifications.INotificationManager
Provides plugin access to the LaunchBox notification system. A plugin can request this service by declaring a public constructor with an Unbroken.LaunchBox.Plugins.Notifications.INotificationManager parameter.

Remarks

Notifications respect the style that the user has selected under Options. Plugins cannot force a particular presentation style. Big Box does not currently provide a notification system, so operations return an unavailable result there.

Messages and action labels accept a required fallback through Unbroken.LaunchBox.Plugins.PluginText and an optional package string-resource key. LaunchBox selects the user's language and formats any supplied values.

LaunchBox visibly attributes notifications to the requesting plugin. The default image comes from the plugin manifest or the conventional plugin.icon package image resource; no image is displayed when neither is available. Plugins can select another image by resource ID, but cannot replace the host-controlled attribution.

Operations can be called from any thread. A returned task completes after LaunchBox has processed the request. When the selected presentation is a message box, that can include waiting for the user to dismiss it.

New notifications contribute to the unread count until the user reads or dismisses them. Plugins can observe that state but cannot change it.

An identical message is suppressed for five seconds after publication. Notifications are also subject to an overall rate limit and a 50-notification retention limit. A suppressed request returns a result instead of displaying another notification.

Argument validation and cancellation use normal .NET exceptions. Runtime presentation failures are reported through Unbroken.LaunchBox.Plugins.Notifications.PluginNotificationResult.Status instead of being thrown. Added in LaunchBox 14.1.

Example

C#
PluginProgressNotificationResult result = await notifications.StartProgressAsync(
    new PluginProgressNotificationArgs(
        new PluginText("Importing {0:N0} games...", gameCount)
        {
            ResourceKey = "notifications.import.running"
        })
    {
        Icon = new PluginNotificationIcon("import.progress")
    },
    cancellationToken);
if (result.Notification is IPluginProgressNotification progress)
{
    await progress.CompleteAsync(
        new PluginProgressCompletionArgs("Import complete."),
        cancellationToken);
}

Methods

AddToNotificationCenterAsync 14.1 Beta

C#
System.Threading.Tasks.Task<Unbroken.LaunchBox.Plugins.Notifications.PluginNotificationResult> AddToNotificationCenterAsync(Unbroken.LaunchBox.Plugins.Notifications.PluginNotificationCenterArgs args, System.Threading.CancellationToken cancellationToken)
Adds a new unread notification to the LaunchBox notification center without displaying a popup.
args 14.1 Beta
The notification message, severity, and presentation settings.
cancellationToken 14.1 Beta
A token used to cancel the operation.

Returns

The publication outcome and the notification handle, when published.

ShowErrorAsync 14.1 Beta

C#
System.Threading.Tasks.Task<Unbroken.LaunchBox.Plugins.Notifications.PluginNotificationResult> ShowErrorAsync(Unbroken.LaunchBox.Plugins.Notifications.PluginNotificationDisplayArgs args, System.Threading.CancellationToken cancellationToken)
Displays a new unread error notification using the user's selected notification style.
args 14.1 Beta
The notification message and display settings.
cancellationToken 14.1 Beta
A token used to cancel the operation.

Returns

The publication outcome and the notification handle, when published.

ShowInfoAsync 14.1 Beta

C#
System.Threading.Tasks.Task<Unbroken.LaunchBox.Plugins.Notifications.PluginNotificationResult> ShowInfoAsync(Unbroken.LaunchBox.Plugins.Notifications.PluginNotificationDisplayArgs args, System.Threading.CancellationToken cancellationToken)
Displays a new unread informational notification using the user's selected notification style.
args 14.1 Beta
The notification message and display settings.
cancellationToken 14.1 Beta
A token used to cancel the operation.

Returns

The publication outcome and the notification handle, when published.

StartProgressAsync 14.1 Beta

C#
System.Threading.Tasks.Task<Unbroken.LaunchBox.Plugins.Notifications.PluginProgressNotificationResult> StartProgressAsync(Unbroken.LaunchBox.Plugins.Notifications.PluginProgressNotificationArgs args, System.Threading.CancellationToken cancellationToken)
Starts a new unread, updateable progress notification in the LaunchBox notification center without displaying a one-off system notification or message box.
args 14.1 Beta
The initial progress message and presentation settings.
cancellationToken 14.1 Beta
A token used to cancel the operation.

Returns

The publication outcome and an updateable notification handle, when published.