Skip to content
ConsoleMonster

API Reference

Class

MenuPreset

Namespace ConsoleMonster.Interactive
Assembly ConsoleMonster
Modifiers sealed

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 6 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 5

Accepted by parameters 1

Constructors

public MenuPreset(String name) #

Creates a built-in preset.

Parameters

name System.String requiredposition: 0
The name; a saved preset cannot take it.

Methods

public MenuPreset Describe(String text) #
Returns: MenuPreset

Sets the description.

Parameters

text System.String requiredposition: 0
The text.

Returns

The preset.

public MenuPreset Form(Form form, IDictionary<String, Object?> values) #
Returns: MenuPreset

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

Parameters

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

Returns

The preset.

Selection 2 overloads
public MenuPreset Selection(MenuItem item, params Object?[] values) #
Returns: MenuPreset

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

Parameters

item ConsoleMonster.Interactive.MenuItem requiredposition: 0
The item.
values System.Object?[] requiredposition: 1
The values to select (the choices' values).

Returns

The preset.

public MenuPreset Selection(MenuItem item, IEnumerable<Object?> values) #
Returns: MenuPreset

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

Parameters

item ConsoleMonster.Interactive.MenuItem requiredposition: 0
The item.
values System.Collections.Generic.IEnumerable<System.Object?> requiredposition: 1
The values to select (the choices' values).

Returns

The preset.

public override String ToString() #
Returns: String

Returns a string that represents the current object.

Returns

A string that represents the current object.

public MenuPreset WithPreview(IWidget preview) #
Returns: MenuPreset

Sets the preview (see MenuPreset.Preview).

Parameters

preview ConsoleMonster.Layout.IWidget requiredposition: 0
The content.

Returns

The preset.

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.