Table of Contents

Namespace SharpConsoleUI.Flows

Classes

Flow

Entry points for running composable flows. Run<T>(ConsoleWindowSystem, Window?, Func<FlowContext, Task<T>>, IFlowHost?, CancellationToken) hosts an imperative flow body (handed a FlowContext) and surfaces its terminal state as a FlowResult<T>: completed with a value, cancelled, or faulted. The declarative wizard loop is added to this same class (Tier B) in a separate partial.

FlowButtonSets

Maps a canonical FlowButtons selector to the concrete ordered list of FlowButton rows (label + navigation verdict + enabled state) the host renders. Shared by FlowContext (Tier A) and the wizard loop (Tier B) so the button-row vocabulary lives in one place.

FlowContext

The imperative context handed to a flow body by Run<T>(ConsoleWindowSystem, Window?, Func<FlowContext, Task<T>>, IFlowHost?, CancellationToken). It exposes the flow's single cancellation Token plus verbs for presenting steps through the current IFlowHost: arbitrary typed content (Show<TResult>(IFlowStepContent<TResult>, string, FlowButtons)) and the built-in primitives (Confirm(string, string, string, string, NotificationSeverityEnum), Prompt(string, string, string?, NotificationSeverityEnum), RunWithProgress<TResult>(string, string, Func<CancellationToken, IProgress<string>, Task<TResult>>)). Each verb returns only the resolved value; a Cancel verdict (button or dismiss) maps to default/false/null.

FlowStepConfig<TState>

Fluent per-step customization sub-builder for a content+buttons wizard step (see Step(Func<TState, IFlowStepContent<object?>>)). Lets the app override the affirmative button label/enable predicate and supply click callbacks whose returned FlowVerdict drives the loop. Its members return this sub-builder; the parent wizard's builder methods (Step, WithStepIndicator, WithTitle, Seed, Run) are forwarded so chaining the next step or running flows naturally.

FlowWizardBuilder<TState>

Fluent builder for a declarative Wizard<TState>(). Steps are added in order and reduced to a single navigation loop. Two step forms coexist:

  1. Code-driven — a Func<T1, T2, TResult> that runs the step body (using the shared FlowContext and state) and returns a FlowVerdict directly.
  2. Content + standardized buttons — a content factory that returns IFlowStepContent<TResult> (typed as object?); the wizard renders the context-aware button row, presents the content, and maps the chosen button to a verdict, applying any per-step fluent overrides (FlowStepConfig<TState>).
ModalWindowHost

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.

SwapContentHost

An opt-in IFlowHost that presents every step in ONE reused modal window, swapping the window's content per step instead of opening a fresh window each time. This gives a seamless wizard experience (no open/close flicker between steps), in contrast to the framework-default ModalWindowHost (a fresh modal per step).

Structs

FlowButton

A single rendered button in a flow's button row.

FlowChrome

Chrome hints supplied to a flow step when building its content. The host uses these to size and decorate the host window; the content may read them to size its own body.

FlowResult<T>

Represents the outcome of a completed flow run, carrying either a typed value, a cancellation signal, or a fault with the originating exception.

FlowStepOutcome<TResult>

Combines the typed result value produced by a step's content with the navigation verdict chosen by the button that resolved the step.

Interfaces

IFlowHost

The pluggable presentation seam for flow steps. A host takes an IFlowStepContent<TResult> plus its FlowChrome, renders it (with the standardized button row), and resolves to a FlowStepOutcome<TResult> carrying BOTH the content's typed value AND the chosen navigation verdict — so a wizard can navigate Next/Back/Cancel/Finish.

IFlowStepContent<TResult>

A self-contained flow step body that produces a typed result. The host places the control returned by BuildContent(FlowChrome) inside the step window and awaits Completion (or a button click) to resolve the step.

Enums

FlowButtons

Standardized button-set selector; determines which canonical button row the host renders.

FlowVerdict

Verdict returned by a flow button or step outcome, controlling navigation.