MenuContext
ConsoleMonster.Interactive
What an action gets from the menu: the item, the submitted form values, prompts drawn over the app, toasts, a live dashboard run that returns to the menu with a results summary, and navigation.
Inheritance
- object
- MenuContext
Usage
Explore 33 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 11
- Property FormOptions.AfterSubmit
- Property MenuItem.Action
- Property MenuItem.ActionAsync
- Property MenuItem.LoadChoices
- Property MenuItem.OnChange
- Property MenuItem.OnSubmit
- Property MenuItem.Page
- Property MenuItem.Review
- Property PaletteCommand.Invoke
- Property ReviewModel.Action
- Property RunContext.Menu
Accepted by parameters 22
- Extension method FormOptions.WhenSubmitted
- Method FormOptionsFluent.WhenSubmitted
- Extension method MenuItem.ChoicesBy
- Extension method MenuItem.Form
- Extension method MenuItem.PageBy
- Extension method MenuItem.ReviewBy
- Extension method MenuItem.Run
- Extension method MenuItem.RunAsync
- Extension method MenuItem.WhenChanged
- Extension method MenuItem.WhenSubmitted
- Method MenuItemFluent.ChoicesBy
- Method MenuItemFluent.Form
- Method MenuItemFluent.PageBy
- Method MenuItemFluent.ReviewBy
- Method MenuItemFluent.Run
- Method MenuItemFluent.RunAsync
- Method MenuItemFluent.WhenChanged
- Method MenuItemFluent.WhenSubmitted
- Method MenuRunResult.Next
- Constructor PaletteCommand.PaletteCommand
- Extension method ReviewModel.Run
- Method ReviewModelFluent.Run
Methods
public T? Ask<T>(Prompt<T?> prompt) #Asks a prompt in front of the app and returns the answer.
Type Parameters
- T
- The answer type.
Parameters
- prompt ConsoleMonster.Interactive.Prompt<T?>
- The prompt.
Returns
T? The answer.public bool Confirm(string question, bool defaultValue = false) #Asks a yes/no question in front of the app.
Parameters
- question string
- The question.
- defaultValue bool = false
- The default answer.
Returns
bool The answer.public void Log(string text, StatusKind status = Info) #Reports a line of output from the action. While the app owns the screen the line is kept and shown when the action returns (a toast for one line, an output dialog for several) instead of being drawn over the app; in the inline layout it is written to the console.
Parameters
- text string
- The line.
- status ConsoleMonster.Styling.StatusKind = Info
- Info for plain output, Warn or Fail to colour it.
public void Toast(string text, StatusKind status = Pass) #Shows a short notice in the footer.
Parameters
- text string
- The text.
- status ConsoleMonster.Styling.StatusKind = Pass
- The status (mark and colour).
Inherited Methods
Properties
public FormValues? Values { get; } #The values of the submitted form, if the action follows a form.
public FormResult? FormResult { get; internal set; } #The form result, if the action follows a form.
public CancellationToken CancellationToken { get; } #Cancelled when the menu ends (or Esc cancels an asynchronous action).