API Reference
MenuContext
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 19 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.AsyncHandler
- Property MenuItem.ChoicesLoader
- Property MenuItem.FormSubmitted
- Property MenuItem.Handler
- Property MenuItem.PageFactory
- Property MenuItem.ReviewFactory
- Property MenuItem.SelectionChanged
- Property PaletteCommand.Invoke
- Property ReviewModel.Run
- Property RunContext.Menu
Accepted by parameters 8
- Method MenuItem.Action
- Method MenuItem.ActionAsync
- Method MenuItem.Form
- Method MenuItem.LoadChoices
- Method MenuItem.Page
- Method MenuItem.Review
- Constructor PaletteCommand.PaletteCommand
- Method RunResult.Next
Methods
public T? Ask<T>(Prompt<T?> prompt) #T?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
The answer.
public Boolean Confirm(String question, Boolean defaultValue = false) #BooleanAsks a yes/no question in front of the app.
Parameters
- question System.String
- The question.
- defaultValue System.Boolean = false
- The default answer.
Returns
The answer.
public Void Log(String text, StatusKind status = Info) #VoidReports 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 System.String
- The line.
- status ConsoleMonster.Styling.StatusKind = Info
- Info for plain output, Warn or Fail to colour it.
public RunResult Run(IWidget dashboard, Func<RunContext, RunResult?> work, LiveSessionOptions? options = null) #RunResultRuns work with a live dashboard on the app's screen; when the work returns, the menu comes back and shows the result with its next actions. Prompts during the run pause the dashboard and appear in front of it.
Parameters
- dashboard ConsoleMonster.Layout.IWidget
- The dashboard.
- work System.Func<ConsoleMonster.Interactive.RunContext, ConsoleMonster.Interactive.RunResult?>
- The work; returns the result to show (null shows a plain "done").
- options ConsoleMonster.Live.LiveSessionOptions? = null
- Live session options; the output is managed by the menu.
Returns
The result.
public Void ShowResult(RunResult result) #VoidShows a result page (summary and next actions) in the content area.
Parameters
- result ConsoleMonster.Interactive.RunResult
- The result.
public Void Toast(String text, StatusKind status = Pass) #VoidShows a short notice in the footer.
Parameters
- text System.String
- The text.
- status ConsoleMonster.Styling.StatusKind = Pass
- The status (mark and colour).
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
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).