Skip to content
ConsoleMonster

API Reference

Class

Spinner

Namespace ConsoleMonster.Widgets
Assembly ConsoleMonster
Modifiers sealed

A one-line activity indicator for work without a known total: ⠹ Resolving DNS records zone 4 of ? 3.2s. While running it animates with the frame counter (braille in Full, | / - \ in Basic and ASCII); once finished it shows the status marker in the status tone and the final duration. Live operations: label (Text), detail (Text), state (State, optional Text as the detail), start (restarts the clock and returns to running).

Inheritance

Usage

Explore 24 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.

Accepted by parameters 12

Constructors

public Spinner(String label = "", String name = "spinner") #

Creates a spinner.

Parameters

label System.String = "" optionalposition: 0
The label (markup).
name System.String = "spinner" optionalposition: 1
The live name (default spinner).

Methods

public override Void Apply(LiveEvent liveEvent) #
Returns: Void

Applies an event to the widget's state.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent requiredposition: 0
The event.
public override String? Describe(LiveEvent liveEvent) #
Returns: String?

Returns a line describing the event for line-based outputs (Stream/Plain), or null when the event is not worth a line (for example a single counter increment). Called after ILiveTarget.Apply.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent requiredposition: 0
The event that was applied.

Returns

A plain line or null.

public String? GetSummaryLine() #
Returns: String?

Returns the current status, or null to omit this target from the heartbeat.

Returns

The plain-text status line.

public SpinnerHandle Handle(ILiveDispatcher dispatcher) #
Returns: SpinnerHandle

Returns a handle that updates this spinner through a dispatcher.

Parameters

dispatcher ConsoleMonster.Live.ILiveDispatcher requiredposition: 0
The dispatcher.

Returns

The handle.

public override Size Measure(Constraints constraints, RenderContext context) #
Returns: Size

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints requiredposition: 0
The space offered.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.

Returns

The desired size, never larger than the constraints.

public override Void Render(Region region, RenderContext context) #
Returns: Void

Renders into a region. The region may be smaller or larger than the measured size.

Parameters

region ConsoleMonster.Canvas.Region requiredposition: 0
The target region.
context ConsoleMonster.Canvas.RenderContext requiredposition: 1
Profile, theme and glyphs.
public Boolean TryGetTaskbarProgress(out TaskbarState state, out Double fraction) #
Returns: Boolean

The widget's contribution, if any.

Parameters

state ConsoleMonster.Output.TaskbarState requiredposition: 0
The state (Normal, Indeterminate, Error or Paused).
fraction System.Double requiredposition: 1
The fraction done (0 to 1), or NaN when unknown.

Returns

False when the widget has nothing to report.

Properties

public String Label { get; set; } #

The label (markup).

public String? Detail { get; set; } #

Muted detail shown after the label, for example the current item.

public StatusKind Status { get; set; } #

The status; anything other than Running or Pending replaces the animation with the status marker.

public Boolean ShowElapsed { get; set; } #

Whether the elapsed time is shown on the right (default true).

public TimeSpan? Started { get; set; } #

When the current run started on the session clock, or null for "when the session started". Set by the start operation and by the first running state event.

public TimeSpan? Finished { get; set; } #

When the spinner finished on the session clock, or null while running.

public Boolean IsFinished { get; } #

Whether the spinner reached a final status.

Extension Methods

public static Spinner WithDetail(Spinner spinner, String? value) #
Returns: Spinner

Sets Spinner.Detail: Muted detail shown after the label, for example the current item.

Parameters

spinner ConsoleMonster.Widgets.Spinner requiredposition: 0
The instance.
value System.String? requiredposition: 1
The value.

Returns

The same instance.

public static Spinner WithFinished(Spinner spinner, TimeSpan? value) #
Returns: Spinner

Sets Spinner.Finished: When the spinner finished on the session clock, or null while running.

Parameters

spinner ConsoleMonster.Widgets.Spinner requiredposition: 0
The instance.
value System.TimeSpan? requiredposition: 1
The value.

Returns

The same instance.

public static Spinner WithLabel(Spinner spinner, String value) #
Returns: Spinner

Sets Spinner.Label: The label (markup).

Parameters

spinner ConsoleMonster.Widgets.Spinner requiredposition: 0
The instance.
value System.String requiredposition: 1
The value.

Returns

The same instance.

public static Spinner WithShowElapsed(Spinner spinner, Boolean value = true) #
Returns: Spinner

Sets Spinner.ShowElapsed: Whether the elapsed time is shown on the right (default true).

Parameters

spinner ConsoleMonster.Widgets.Spinner requiredposition: 0
The instance.
value System.Boolean = true optionalposition: 1
The value (default true).

Returns

The same instance.

public static Spinner WithStarted(Spinner spinner, TimeSpan? value) #
Returns: Spinner

Sets Spinner.Started: When the current run started on the session clock, or null for "when the session started". Set by the start operation and by the first running state event.

Parameters

spinner ConsoleMonster.Widgets.Spinner requiredposition: 0
The instance.
value System.TimeSpan? requiredposition: 1
The value.

Returns

The same instance.

public static Spinner WithStatus(Spinner spinner, StatusKind value) #
Returns: Spinner

Sets Spinner.Status: The status; anything other than Running or Pending replaces the animation with the status marker.

Parameters

spinner ConsoleMonster.Widgets.Spinner requiredposition: 0
The instance.
value ConsoleMonster.Styling.StatusKind requiredposition: 1
The value.

Returns

The same instance.