Class ModalWindowHost
- Namespace
- SharpConsoleUI.Flows
- Assembly
- SharpConsoleUI.dll
The framework-default IFlowHost: each step is presented in a fresh modal window
(AsModal()). The window hosts the step body, a separator rule, and the
standardized right-aligned button row built from Buttons. The window is
disposed in a finally, so cancel/fault never leaks a window.
public sealed class ModalWindowHost : IFlowHost
- Inheritance
-
ModalWindowHost
- Implements
- Inherited Members
- Extension Methods
Remarks
Resolution paths (whichever fires first wins, via TrySetResult):
- A host-rendered button click resolves with that button's FlowVerdict.
- The content completing its own Completion resolves with Next (body self-resolve).
- Token cancellation or window dismissal resolves with Cancel.
Double-button-row decision: the host renders the button row ONLY from
Buttons. The framework primitives build their own OK/Cancel buttons inside
BuildContent and resolve their own Completion; callers present them with an empty
Buttons set so no second row is rendered (their standalone
Dialogs.* path does not go through this host at all).
Constructors
ModalWindowHost(ConsoleWindowSystem, Window?)
Initializes a new ModalWindowHost.
public ModalWindowHost(ConsoleWindowSystem ws, Window? parent)
Parameters
wsConsoleWindowSystemThe window system to present steps in.
parentWindowOptional parent window; when provided each step modal is modal to it.
Methods
PresentAsync<TResult>(IFlowStepContent<TResult>, FlowChrome, CancellationToken)
Presents content using chrome and resolves to its outcome.
public Task<FlowStepOutcome<TResult>> PresentAsync<TResult>(IFlowStepContent<TResult> content, FlowChrome chrome, CancellationToken ct)
Parameters
contentIFlowStepContent<TResult>The step body to present.
chromeFlowChromeChrome hints (title, size, step indicator, button row).
ctCancellationTokenCancellation token; when tripped the step resolves with Cancel.
Returns
- Task<FlowStepOutcome<TResult>>
A task completing with the step's FlowStepOutcome<TResult>: the content value plus the navigation verdict (or
(default, Cancel)on dismiss/cancellation).
Type Parameters
TResultThe content's result type.