API Reference
SummaryBar
One line that sums up a run: a thin progress bar, done of total, the percentage, the time left, and counters in a fixed order (passed, failed, skipped...) with zeros dimmed rather than hidden, so the line does not jump as counts appear. The time left is estimated from the elapsed time and the share done. Live operations: progress (Value = done, Total = total), counter (Key = label, Value = count, State = status word for its symbol and colour).
Inheritance
- LiveWidget
- SummaryBar
Usage
Explore 18 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 10
- Extension method SummaryBar.WithBarWidth
- Extension method SummaryBar.WithDoneLabel
- Extension method SummaryBar.WithElapsed
- Extension method SummaryBar.WithShowDuration
- Method SummaryBar.SetCounter
- Method SummaryBar.SetProgress
- Method SummaryBarFluent.WithBarWidth
- Method SummaryBarFluent.WithDoneLabel
- Method SummaryBarFluent.WithElapsed
- Method SummaryBarFluent.WithShowDuration
Accepted by parameters 8
- Extension method SummaryBar.WithBarWidth
- Extension method SummaryBar.WithDoneLabel
- Extension method SummaryBar.WithElapsed
- Extension method SummaryBar.WithShowDuration
- Method SummaryBarFluent.WithBarWidth
- Method SummaryBarFluent.WithDoneLabel
- Method SummaryBarFluent.WithElapsed
- Method SummaryBarFluent.WithShowDuration
Constructors
public SummaryBar(String name = "summary") #Creates a summary bar.
Parameters
- name System.String = "summary"
- The live name (default summary).
Methods
public override Void Apply(LiveEvent liveEvent) #VoidApplies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public StyledLine Line(Int32 width, RenderContext context) #StyledLineThe text after the bar at a width: done of total, the percentage, the time left, then as many counters as fit.
Parameters
- width System.Int32
- The width.
- context ConsoleMonster.Canvas.RenderContext
- The render context.
Returns
The line.
public override Size Measure(Constraints constraints, RenderContext context) #SizeReturns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
Returns
The desired size, never larger than the constraints.
public override Void Render(Region region, RenderContext context) #VoidRenders 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 SummaryBar SetCounter(String label, Int32 count, StatusKind? status = null) #SummaryBarAdds or updates a counter; counters keep the order they were first added in.
Parameters
- label System.String
- The label ("passed"), or a format with the count as {0} ("{0} passed", as the built-in labels are).
- count System.Int32
- The count.
- status ConsoleMonster.Styling.StatusKind? = null
- A status for the symbol and colour, or null for plain text.
Returns
This instance.
public SummaryBar SetProgress(Double done, Double total) #SummaryBarSets the progress.
Parameters
- done System.Double
- Items done.
- total System.Double
- Items in total (0 = unknown).
Returns
This instance.
Inherited Methods
public virtual String? Describe(LiveEvent liveEvent) #String?Parameters
- liveEvent LiveEvent
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public Double Total { get; private set; } #Items in total (0 = unknown: no bar, percentage or time left).
public Int32 BarWidth { get; set; } #The bar width in cells (default 20; narrow regions shrink it).
public TimeSpan? Elapsed { get; set; } #The elapsed time to estimate from, or null (default) for the time since the first progress.
public Boolean ShowDuration { get; set; } #Whether a finished run shows how long it took ("in 12s") after the counters (default true; needs SummaryBar.Elapsed).
public String? DoneLabel { get; set; } #The label for the count done while the total is unknown, with {0} for the count, or null (default) for "{0} done".
public TimeSpan? Remaining { get; } #The time left, estimated from the elapsed time and the share done, or null while it cannot be known.
Inherited Properties
Extension Methods
public static SummaryBar WithBarWidth(SummaryBar summaryBar, Int32 value) #SummaryBarSets SummaryBar.BarWidth: The bar width in cells (default 20; narrow regions shrink it).
Parameters
- summaryBar ConsoleMonster.Widgets.SummaryBar
- The instance.
- value System.Int32
- The value.
Returns
The same instance.
public static SummaryBar WithDoneLabel(SummaryBar summaryBar, String? value) #SummaryBarSets SummaryBar.DoneLabel: The label for the count done while the total is unknown, with {0} for the count, or null (default) for "{0} done".
Parameters
- summaryBar ConsoleMonster.Widgets.SummaryBar
- The instance.
- value System.String?
- The value.
Returns
The same instance.
public static SummaryBar WithElapsed(SummaryBar summaryBar, TimeSpan? value) #SummaryBarSets SummaryBar.Elapsed: The elapsed time to estimate from, or null (default) for the time since the first progress.
Parameters
- summaryBar ConsoleMonster.Widgets.SummaryBar
- The instance.
- value System.TimeSpan?
- The value.
Returns
The same instance.
public static SummaryBar WithShowDuration(SummaryBar summaryBar, Boolean value = true) #SummaryBarSets SummaryBar.ShowDuration: Whether a finished run shows how long it took ("in 12s") after the counters (default true; needs SummaryBar.Elapsed).
Parameters
- summaryBar ConsoleMonster.Widgets.SummaryBar
- The instance.
- value System.Boolean = true
- The value (default true).
Returns
The same instance.