PluginFormAction14.1
Class in Unbroken.LaunchBox.Plugins.Models.Forms
public sealed class PluginFormAction : PluginFormElementAn explicitly invoked operation displayed alongside a form's fields and groups.
Remarks
Actions have no field ID or submitted value. Invoking an action does not submit the form, save its drafts, or close it. Completed effects are not rolled back when the form is cancelled.Inheritance and interfaces
Constructors
PluginFormActionCreates a form action.
PluginFormAction
public PluginFormAction(
PluginText label,
Func<IReadOnlyDictionary<string, string?>,
CancellationToken,
Task<PluginFormResult>> executeAsync,
PluginText? description = null
)Creates a form action.
label- The localizable button label.
executeAsync- Receives a detached snapshot of the displayed field values, including unsaved edits and secret fields, and a cancellation token. For scoped forms, values belong to the currently displayed scope. The callback must yield promptly, observe cancellation, and return a non-null result. The host does not validate or persist these values automatically.
description- Optional localizable help below the button.
Properties
DescriptionGets the optional localizable description.ExecuteAsyncGets the operation invoked only by an explicit user action.IsEnabledGets or initializes whether this action is available when the form is presented. The default is true.LabelGets the localizable label, or null for an unnamed group.
Description
public override PluginText? Description { get; }Gets the optional localizable description.
ExecuteAsync
public Func<IReadOnlyDictionary<string, string?>, CancellationToken, Task<PluginFormResult>> ExecuteAsync { get; }Gets the operation invoked only by an explicit user action.
Remarks
The host prevents overlapping actions and submission within the same form, presents returned errors, and observes exceptions. Cancellation is requested when the form closes, is disposed, or its displayed values are replaced. Success does not mark the form as saved.IsEnabled
public bool IsEnabled { get; init; }Gets or initializes whether this action is available when the form is presented. The default is true.
Remarks
Return a new form to change this snapshot. Use PluginFormAction.VisibleWhen for visibility controlled by another field.Label
public override PluginText Label { get; }Gets the localizable label, or null for an unnamed group.
Methods
VisibleWhenReturns a copy displayed only when a field has the specified value.
VisibleWhen
public override PluginFormAction VisibleWhen(string key, string value)Returns a copy displayed only when a field has the specified value.
key- The controlling field ID, matched without regard to case. A missing controller leaves the element visible.
value- The required value. Boolean values are compared as Booleans; other values are ordinal.