Skip to content
ConsoleMonster
Class

MenuPreset

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed
Attributes
Fluent

A preset the app comes with (Menu.Presets): selections of selection items and values of forms under one name. A MenuItem.Presets item lists it before the presets people save, marked as built in; it cannot be overwritten or deleted, and applying it changes what it names the way a saved preset does (items and fields it does not name keep their values). Configure it with the chainable methods: preset.Selection(targets, "SRV01", "SRV02").Form(patch, values).

Inheritance

  • object
  • MenuPreset

Usage

Explore 16 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 7

Accepted by parameters 9

Constructors

public MenuPreset(string name) #

Creates a built-in preset.

Parameters

name string required
The name; a saved preset cannot take it.

Methods

public MenuPreset Form(Form form, IDictionary<string, object?> values) #

Sets field values of a form opened from the menu (see Form.Apply for how they apply).

Parameters

form ConsoleMonster.Interactive.Form required
The form.
values System.Collections.Generic.IDictionary<string, object?> required
Values by field name, as the fields take them: a string, a number, a bool, or a list for a multi-choice field.

Returns

MenuPreset The preset.
Selection 2 overloads
public MenuPreset Selection(MenuItem item, params object?[] values) #

Selects values in a selection item (single or multi) of the menu; values it does not list are skipped.

Parameters

item ConsoleMonster.Interactive.MenuItem required
The item.
values object?[] required
The values to select (the choices' values).

Returns

MenuPreset The preset.
public MenuPreset Selection(MenuItem item, IEnumerable<object?> values) #

Selects values in a selection item (single or multi) of the menu; values it does not list are skipped.

Parameters

item ConsoleMonster.Interactive.MenuItem required
The item.
values System.Collections.Generic.IEnumerable<object?> required
The values to select (the choices' values).

Returns

MenuPreset The preset.
public override string ToString() #

Returns a string that represents the current object.

Returns

string A string that represents the current object.

Properties

public string Name { get; } #

The name.

public string? Description { get; set; } #

A sentence about the preset, shown while it has focus in the list, or null.

public IWidget? Preview { get; set; } #

Content shown beside the list (or below it when narrow) while the preset has focus, such as what it sets; or null.

Extension Methods

public static MenuPreset Description(MenuPreset menuPreset, string? value) #

Sets MenuPreset.Description: A sentence about the preset, shown while it has focus in the list, or null.

Parameters

menuPreset ConsoleMonster.Interactive.MenuPreset required
The instance.
value string? required
The value.

Returns

MenuPreset The same instance.

Examples

// C# initializer or property      // C# fluent
menuPreset.Description = value;    menuPreset.Description(value);
public static MenuPreset Preview(MenuPreset menuPreset, IWidget? value) #

Sets MenuPreset.Preview: Content shown beside the list (or below it when narrow) while the preset has focus, such as what it sets; or null.

Parameters

menuPreset ConsoleMonster.Interactive.MenuPreset required
The instance.
value ConsoleMonster.Layout.IWidget? required
The value.

Returns

MenuPreset The same instance.

Examples

// C# initializer or property    // C# fluent
menuPreset.Preview = value;      menuPreset.Preview(value);