PluginNotificationAction14.1
Class in Unbroken.LaunchBox.Plugins.Services.Notifications
public sealed class PluginNotificationAction
Describes an action that the user can invoke from a plugin notification.
Remarks
The callback begins in response to a user-interface command and should yield promptly when doing longer-running work. LaunchBox observes and logs callback exceptions so they do not escape through the notification UI.Constructors
PluginNotificationAction(string, Func<…>)Initializes an action that can be invoked from a notification.PluginNotificationAction(PluginText, Func<…>)Initializes an action that can be invoked from a notification.
PluginNotificationAction(string, Func<…>)
public PluginNotificationAction(
string label,
Func<CancellationToken, Task> executeAsync
)Initializes an action that can be invoked from a notification.
label- The action label as literal text.
executeAsync- The asynchronous callback. Its token is cancelled when the notification is dismissed while the action runs.
PluginNotificationAction(PluginText, Func<…>)
public PluginNotificationAction(
PluginText label,
Func<CancellationToken, Task> executeAsync
)Initializes an action that can be invoked from a notification.
label- The action label as literal or package-localized text.
executeAsync- The asynchronous callback. Its token is cancelled when the notification is dismissed while the action runs.
Properties
DismissNotificationAfterExecutionGets whether the notification should be dismissed after the callback completes. The default is true.ExecuteAsyncGets the callback invoked when the user selects the action. Its cancellation token is cancelled if the notification is dismissed while the callback is running.LabelGets the user-facing action label. LaunchBox collapses whitespace and truncates labels longer than 80 characters.
DismissNotificationAfterExecution
public bool DismissNotificationAfterExecution { get; init; }
Gets whether the notification should be dismissed after the callback completes. The default is true.
ExecuteAsync
public Func<CancellationToken, Task> ExecuteAsync { get; }
Gets the callback invoked when the user selects the action. Its cancellation token is cancelled if the notification is dismissed while the callback is running.
Label
public PluginText Label { get; }
Gets the user-facing action label. LaunchBox collapses whitespace and truncates labels longer than 80 characters.