ProgressBar
ConsoleMonster.Widgets
A labelled Line bar with a track and one value: Build ━━━━━━━╾────── 32/50, or a percentage for a total of 100. Live operations: set (Value, Total), advance (Value = amount), label (Text), state (State).
Inheritance
- LiveWidget
- ProgressBar
Usage
Explore 47 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 23
- Method Ui.ProgressBar
- Extension method ProgressBar.Column
- Extension method ProgressBar.Columns
- Extension method ProgressBar.CountColumn
- Extension method ProgressBar.Label
- Extension method ProgressBar.LabelWidth
- Extension method ProgressBar.RateWindow
- Extension method ProgressBar.Shape
- Extension method ProgressBar.ShowCount
- Extension method ProgressBar.Status
- Extension method ProgressBar.Total
- Extension method ProgressBar.Value
- Method ProgressBarFluent.Column
- Method ProgressBarFluent.Columns
- Method ProgressBarFluent.CountColumn
- Method ProgressBarFluent.Label
- Method ProgressBarFluent.LabelWidth
- Method ProgressBarFluent.RateWindow
- Method ProgressBarFluent.Shape
- Method ProgressBarFluent.ShowCount
- Method ProgressBarFluent.Status
- Method ProgressBarFluent.Total
- Method ProgressBarFluent.Value
Accepted by parameters 24
- Method ContentBuilder.ProgressBar
- Method ContentBuilder.ProgressBar
- Extension method ProgressBar.Column
- Extension method ProgressBar.Columns
- Extension method ProgressBar.CountColumn
- Extension method ProgressBar.Label
- Extension method ProgressBar.LabelWidth
- Extension method ProgressBar.RateWindow
- Extension method ProgressBar.Shape
- Extension method ProgressBar.ShowCount
- Extension method ProgressBar.Status
- Extension method ProgressBar.Total
- Extension method ProgressBar.Value
- Method ProgressBarFluent.Column
- Method ProgressBarFluent.Columns
- Method ProgressBarFluent.CountColumn
- Method ProgressBarFluent.Label
- Method ProgressBarFluent.LabelWidth
- Method ProgressBarFluent.RateWindow
- Method ProgressBarFluent.Shape
- Method ProgressBarFluent.ShowCount
- Method ProgressBarFluent.Status
- Method ProgressBarFluent.Total
- Method ProgressBarFluent.Value
Constructors
public ProgressBar(string label = "", string widgetId = "progress") #Creates a progress bar.
Parameters
- label string = ""
- The label (markup).
- widgetId string = "progress"
- The live name (default progress).
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 ProgressHandle Handle(ILiveDispatcher dispatcher) #Returns a handle that updates this bar 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 StatusKind Status { get; set; } #The status; Pass/Fail/Warn change the bar colour once finished.
public bool ShowCount { get; set; } #Whether totals other than 100 show value/total (default true); false shows a percentage. A total of 100 always shows only a percentage.
public BarShape Shape { get; set; } #The bar shape: BarShape.Line (default, a thin stroke) or BarShape.Block (solid blocks).
public ColumnFormat CountColumn { get; set; } #Layout of the value in the value/total count (default right-aligned). The value reserves the width of the total, so the bar keeps its length as the value grows from 9 to 10.
public int? LabelWidth { get; set; } #A fixed label column width, or null to fit the label.
public IList<ProgressColumn>? Columns { get; set; } #The columns of the bar's row (see ProgressColumns: description, bar, percent, count, elapsed, remaining time, rate, custom...), or null (default) for the classic label, bar, percentage and count. With columns set, the stream heartbeat line summarises the bar through them.
public TimeSpan RateWindow { get; set; } #The moving window that smooths the rate and the remaining time (default 10 seconds).
Inherited Properties
Extension Methods
public static ProgressBar Column(ProgressBar progressBar, ProgressColumn item) #Adds an item to ProgressBar.Columns: The columns of the bar's row (see ProgressColumns: description, bar, percent, count, elapsed, remaining time, rate, custom...), or null (default) for the classic label, bar, percentage and count. With columns set, the stream heartbeat line summarises the bar through them.
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- item ConsoleMonster.Widgets.ProgressColumn
- The item.
public static ProgressBar Columns(ProgressBar progressBar, IEnumerable<ProgressColumn> items) #Adds items to ProgressBar.Columns: The columns of the bar's row (see ProgressColumns: description, bar, percent, count, elapsed, remaining time, rate, custom...), or null (default) for the classic label, bar, percentage and count. With columns set, the stream heartbeat line summarises the bar through them.
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- items System.Collections.Generic.IEnumerable<ConsoleMonster.Widgets.ProgressColumn>
- The items, in order.
public static ProgressBar CountColumn(ProgressBar progressBar, ColumnFormat value) #Sets ProgressBar.CountColumn: Layout of the value in the value/total count (default right-aligned). The value reserves the width of the total, so the bar keeps its length as the value grows from 9 to 10.
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value ConsoleMonster.Layout.ColumnFormat
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { CountColumn = value }; Ui.ProgressBar().CountColumn(value);public static ProgressBar CountColumn(ProgressBar progressBar, Action<ColumnFormat> configure) #Configures ProgressBar.CountColumn in place: Layout of the value in the value/total count (default right-aligned). The value reserves the width of the total, so the bar keeps its length as the value grows from 9 to 10.
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- configure System.Action<ConsoleMonster.Layout.ColumnFormat>
- Configures the value.
public static ProgressBar Label(ProgressBar progressBar, string value) #Sets ProgressBar.Label: The label (markup).
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { Label = value }; Ui.ProgressBar().Label(value);public static ProgressBar LabelWidth(ProgressBar progressBar, int? value) #Sets ProgressBar.LabelWidth: A fixed label column width, or null to fit the label.
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value int?
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { LabelWidth = value }; Ui.ProgressBar().LabelWidth(value);public static ProgressBar RateWindow(ProgressBar progressBar, TimeSpan value) #Sets ProgressBar.RateWindow: The moving window that smooths the rate and the remaining time (default 10 seconds).
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value System.TimeSpan
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { RateWindow = value }; Ui.ProgressBar().RateWindow(value);public static ProgressBar Shape(ProgressBar progressBar, BarShape value) #Sets ProgressBar.Shape: The bar shape: BarShape.Line (default, a thin stroke) or BarShape.Block (solid blocks).
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value ConsoleMonster.Widgets.BarShape
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { Shape = value }; Ui.ProgressBar().Shape(value);public static ProgressBar ShowCount(ProgressBar progressBar, bool value = true) #Sets ProgressBar.ShowCount: Whether totals other than 100 show value/total (default true); false shows a percentage. A total of 100 always shows only a percentage.
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { ShowCount = value }; Ui.ProgressBar().ShowCount(value);public static ProgressBar Status(ProgressBar progressBar, StatusKind value) #Sets ProgressBar.Status: The status; Pass/Fail/Warn change the bar colour once finished.
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value ConsoleMonster.Styling.StatusKind
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { Status = value }; Ui.ProgressBar().Status(value);public static ProgressBar Total(ProgressBar progressBar, double value) #Sets ProgressBar.Total: The total (default 100).
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value double
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { Total = value }; Ui.ProgressBar().Total(value);public static ProgressBar Value(ProgressBar progressBar, double value) #Sets ProgressBar.Value: The current value.
Parameters
- progressBar ConsoleMonster.Widgets.ProgressBar
- The instance.
- value double
- The value.
Examples
// C# initializer or property // C# fluent
new global::ConsoleMonster.Widgets.ProgressBar { Value = value }; Ui.ProgressBar().Value(value);