PluginFormField14.1
Class in Unbroken.LaunchBox.Plugins.Models.Forms
public sealed class PluginFormField : PluginFormElement
Defines one host-renderable plugin form field.
Inheritance and interfaces
Constructors
PluginFormField(string, string, PluginFormFieldType, string, bool, string, IReadOnlyList<…>, Uri, string)Initializes a new instance of the PluginFormField class.PluginFormField(string, PluginText, PluginFormFieldType, PluginText, bool, string, IReadOnlyList<…>, Uri, PluginText)Initializes a field with localizable, formattable presentation text.
PluginFormField(string, string, PluginFormFieldType, string, bool, string, IReadOnlyList<…>, Uri, string)
public PluginFormField(
string id,
string label,
PluginFormFieldType type,
string? description = null,
bool isRequired = false,
string? defaultValue = null,
IReadOnlyList<PluginFormFieldOption>? options = null,
Uri? helpUri = null,
string? helpLabel = null
)Initializes a new instance of the PluginFormField class.
id- The stable form-local field ID used as the submitted dictionary key.
label- The literal label used when localization is unavailable.
type- The host-renderable field type.
description- An optional literal description used when localization is unavailable.
isRequired- Whether the plugin requires a submitted value.
defaultValue- An optional default value. Secret fields cannot define one.
options- The options for a choice field, or
nullfor other field types.
helpUri- An optional absolute help URI.
helpLabel- The literal help-link label required when
helpUriis supplied.
PluginFormField(string, PluginText, PluginFormFieldType, PluginText, bool, string, IReadOnlyList<…>, Uri, PluginText)
public PluginFormField(
string id,
PluginText label,
PluginFormFieldType type,
PluginText? description = null,
bool isRequired = false,
string? defaultValue = null,
IReadOnlyList<PluginFormFieldOption>? options = null,
Uri? helpUri = null,
PluginText? helpLabel = null
)Initializes a field with localizable, formattable presentation text.
id- The stable form-local field ID used as the submitted dictionary key.
label- The label, including its required fallback format.
type- The host-renderable field type.
description- An optional description with its fallback format.
isRequired- Whether the plugin requires a submitted value.
defaultValue- An optional data value. Secret fields cannot define one.
options- The options for a choice field, or null for other field types.
helpUri- An optional absolute help URI.
helpLabel- The help-link label required when a help URI is supplied.
Properties
DefaultValueGets the optional default value.DescriptionGets the optional localizable, formattable description.HelpLabelGets the localizable, formattable help-link label.HelpUriGets the absolute help URI.IdGets the stable form-local field ID.IsRequiredGets whether the plugin requires a submitted value.LabelGets the localizable, formattable label and its fallback format.MaximumGets the inclusive maximum for an integer field.MinimumGets the inclusive minimum for an integer field.OptionsGets the choices available for a choice field.TypeGets the host-renderable field type.
DefaultValue
public string? DefaultValue { get; }Gets the optional default value.
Description
public override PluginText? Description { get; }Gets the optional localizable, formattable description.
HelpLabel
public PluginText? HelpLabel { get; }Gets the localizable, formattable help-link label.
HelpUri
public Uri? HelpUri { get; }Gets the absolute help URI.
Id
public string Id { get; }Gets the stable form-local field ID.
IsRequired
public bool IsRequired { get; }Gets whether the plugin requires a submitted value.
Label
public override PluginText Label { get; }Gets the localizable, formattable label and its fallback format.
Maximum
public int Maximum { get; private init; }Gets the inclusive maximum for an integer field.
Minimum
public int Minimum { get; private init; }Gets the inclusive minimum for an integer field.
Options
public IReadOnlyList<PluginFormFieldOption> Options { get; }Gets the choices available for a choice field.
Type
public PluginFormFieldType Type { get; }Gets the host-renderable field type.
Methods
BooleanCreates a checkbox field.ChoiceCreates a dropdown field.FilePathCreates a file path field with a browse button.FolderPathCreates a folder path field with a browse button.IntegerCreates a bounded whole-number field.TextCreates a text field.VisibleWhenReturns a copy displayed only when another field has the specified value.
Boolean
public static PluginFormField Boolean(
string id,
PluginText label,
bool defaultValue = false,
PluginText? description = null
)Creates a checkbox field.
id- The stable field ID.
label- The localizable label.
defaultValue- The initial Boolean value.
description- Optional localizable help text.
Returns
The field definition.Choice
public static PluginFormField Choice(
string id,
PluginText label,
IReadOnlyList<PluginFormFieldOption> choices,
string? defaultValue = null,
PluginText? description = null
)Creates a dropdown field.
id- The stable field ID.
label- The localizable label.
choices- The available choices; empty string values are allowed.
defaultValue- The initial choice value, or null for no selection.
description- Optional localizable help text.
Returns
The field definition.FilePath
public static PluginFormField FilePath(
string id,
PluginText label,
string? defaultValue = null,
PluginText? description = null
)Creates a file path field with a browse button.
id- The stable field ID.
label- The localizable label.
defaultValue- The initial path.
description- Optional localizable help text.
Returns
The field definition.FolderPath
public static PluginFormField FolderPath(
string id,
PluginText label,
string? defaultValue = null,
PluginText? description = null
)Creates a folder path field with a browse button.
id- The stable field ID.
label- The localizable label.
defaultValue- The initial path.
description- Optional localizable help text.
Returns
The field definition.Integer
public static PluginFormField Integer(
string id,
PluginText label,
int defaultValue = 0,
int minimum = -2147483648,
int maximum = 2147483647,
PluginText? description = null
)Creates a bounded whole-number field.
id- The stable field ID.
label- The localizable label.
defaultValue- The initial value, within the inclusive bounds.
minimum- The inclusive lower bound.
maximum- The inclusive upper bound.
description- Optional localizable help text.
Returns
The field definition.Text
public static PluginFormField Text(
string id,
PluginText label,
string? defaultValue = null,
PluginText? description = null
)Creates a text field.
id- The stable field ID.
label- The localizable label.
defaultValue- The initial value.
description- Optional localizable help text.
Returns
The field definition.VisibleWhen
public override PluginFormField VisibleWhen(string key, string value)Returns a copy displayed only when another field has the specified value.
key- The controlling field ID, matched without regard to case.
value- The required value. Boolean values are compared as Booleans; other values are ordinal.