Spinner
ConsoleMonster.Widgets
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
- LiveWidget
- Spinner
Usage
Explore 27 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 13
- Method Ui.Spinner
- Extension method Spinner.Detail
- Extension method Spinner.Finished
- Extension method Spinner.Label
- Extension method Spinner.ShowElapsed
- Extension method Spinner.Started
- Extension method Spinner.Status
- Method SpinnerFluent.Detail
- Method SpinnerFluent.Finished
- Method SpinnerFluent.Label
- Method SpinnerFluent.ShowElapsed
- Method SpinnerFluent.Started
- Method SpinnerFluent.Status
Accepted by parameters 14
- Method ContentBuilder.Spinner
- Method ContentBuilder.Spinner
- Extension method Spinner.Detail
- Extension method Spinner.Finished
- Extension method Spinner.Label
- Extension method Spinner.ShowElapsed
- Extension method Spinner.Started
- Extension method Spinner.Status
- Method SpinnerFluent.Detail
- Method SpinnerFluent.Finished
- Method SpinnerFluent.Label
- Method SpinnerFluent.ShowElapsed
- Method SpinnerFluent.Started
- Method SpinnerFluent.Status
Constructors
public Spinner(string label = "", string widgetId = "spinner") #Creates a spinner.
Parameters
- label string = ""
- The label (markup).
- widgetId string = "spinner"
- The live name (default spinner).
Methods
public override void Apply(LiveEvent liveEvent) #Applies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public override string? Describe(LiveEvent liveEvent) #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
- The event that was applied.
Returns
string? A plain line or null.public string? GetSummaryLine() #Returns the current status, or null to omit this target from the heartbeat.
Returns
string? The plain-text status line.public SpinnerHandle Handle(ILiveDispatcher dispatcher) #Returns a handle that updates this spinner through a dispatcher.
Parameters
- dispatcher ConsoleMonster.Live.ILiveDispatcher
- The dispatcher.
public override Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public override void Render(Region region, RenderContext context) #Renders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public bool TryGetTaskbarProgress(out TaskbarState state, out double fraction) #The widget's contribution, if any.
Parameters
- state ConsoleMonster.Output.TaskbarState
- The state (Normal, Indeterminate, Error or Paused).
- fraction double
- The fraction done (0 to 1), or NaN when unknown.
Returns
bool False when the widget has nothing to report.Inherited Methods
Properties
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 bool 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.
Inherited Properties
Extension Methods
public static Spinner Detail(Spinner spinner, string? value) #Sets Spinner.Detail: Muted detail shown after the label, for example the current item.
Parameters
- spinner ConsoleMonster.Widgets.Spinner
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Spinner { Detail = value }; Ui.Spinner().Detail(value);public static Spinner Finished(Spinner spinner, TimeSpan? value) #Sets Spinner.Finished: When the spinner finished on the session clock, or null while running.
Parameters
- spinner ConsoleMonster.Widgets.Spinner
- The instance.
- value System.TimeSpan?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Spinner { Finished = value }; Ui.Spinner().Finished(value);public static Spinner Label(Spinner spinner, string value) #Sets Spinner.Label: The label (markup).
Parameters
- spinner ConsoleMonster.Widgets.Spinner
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Spinner { Label = value }; Ui.Spinner().Label(value);public static Spinner ShowElapsed(Spinner spinner, bool value = true) #Sets Spinner.ShowElapsed: Whether the elapsed time is shown on the right (default true).
Parameters
- spinner ConsoleMonster.Widgets.Spinner
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Spinner { ShowElapsed = value }; Ui.Spinner().ShowElapsed(value);public static Spinner Started(Spinner spinner, TimeSpan? value) #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
- The instance.
- value System.TimeSpan?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Spinner { Started = value }; Ui.Spinner().Started(value);public static Spinner Status(Spinner spinner, StatusKind value) #Sets Spinner.Status: The status; anything other than Running or Pending replaces the animation with the status marker.
Parameters
- spinner ConsoleMonster.Widgets.Spinner
- The instance.
- value ConsoleMonster.Styling.StatusKind
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.Spinner { Status = value }; Ui.Spinner().Status(value);