Skip to content
ConsoleMonster
Class

ActivityList

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed

Nested activities with progress, the way Write-Progress describes work: each activity has an id, an optional parent, a status, a percentage (or none) and an estimate of the time left. Children are indented under their parent; completed activities disappear. Empty, it takes no space, so it can sit in any layout and appear only while something reports progress. Events: update with key "id" or "id/parentId", text = activity, state = status, value = percent (negative for unknown) and total = seconds remaining (negative for unknown); complete with the key.

Inheritance

Usage

Explore 15 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 8

Constructors

public ActivityList(string widgetId = "$progress") #

Creates an activity list.

Parameters

widgetId string = "$progress" optional
The target name (default ActivityList.ProgressTarget).

Methods

public override void Apply(LiveEvent liveEvent) #

Applies an event to the widget's state.

Parameters

liveEvent ConsoleMonster.Live.LiveEvent required
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 required
The event that was applied.

Returns

string? A plain line or null.
public override Size Measure(Constraints constraints, RenderContext context) #

Returns the size the widget wants within the constraints.

Parameters

constraints ConsoleMonster.Layout.Constraints required
The space offered.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.

Returns

Size The desired size, never larger than the constraints.
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 required
The target region.
context ConsoleMonster.Canvas.RenderContext required
Profile, theme and glyphs.
public bool TryGetTaskbarProgress(out TaskbarState state, out double fraction) #

The widget's contribution, if any.

Parameters

state ConsoleMonster.Output.TaskbarState required
The state (Normal, Indeterminate, Error or Paused).
fraction double required
The fraction done (0 to 1), or NaN when unknown.

Returns

bool False when the widget has nothing to report.

Properties

public int MaxVisible { get; set; } #

The most activities shown (default 8); more are summarised in one line.

public int Count { get; } #

The number of activities in progress.

public bool ShowElapsed { get; set; } #

Whether each row ends with the time since the activity started, right-aligned (default true).

public bool ShowIds { get; set; } #

Whether each row starts with the activity's id (#3), for parallel work (default false).

Fields

public const string ProgressTarget #

The target name the PowerShell progress bridge posts to.

Value: $progress

Extension Methods

public static ActivityList MaxVisible(ActivityList activityList, int value) #

Sets ActivityList.MaxVisible: The most activities shown (default 8); more are summarised in one line.

Parameters

activityList ConsoleMonster.Widgets.ActivityList required
The instance.
value int required
The value.

Returns

ActivityList The same instance.

Examples

// C# initializer or property                                              // C# fluent
new global::ConsoleMonster.Widgets.ActivityList { MaxVisible = value };    Ui.ActivityList().MaxVisible(value);
public static ActivityList ShowElapsed(ActivityList activityList, bool value = true) #

Sets ActivityList.ShowElapsed: Whether each row ends with the time since the activity started, right-aligned (default true).

Parameters

activityList ConsoleMonster.Widgets.ActivityList required
The instance.
value bool = true optional
The value; true when omitted.

Returns

ActivityList The same instance.

Examples

// C# initializer or property                                               // C# fluent
new global::ConsoleMonster.Widgets.ActivityList { ShowElapsed = value };    Ui.ActivityList().ShowElapsed(value);
public static ActivityList ShowIds(ActivityList activityList, bool value = true) #

Sets ActivityList.ShowIds: Whether each row starts with the activity's id (#3), for parallel work (default false).

Parameters

activityList ConsoleMonster.Widgets.ActivityList required
The instance.
value bool = true optional
The value; true when omitted.

Returns

ActivityList The same instance.

Examples

// C# initializer or property                                           // C# fluent
new global::ConsoleMonster.Widgets.ActivityList { ShowIds = value };    Ui.ActivityList().ShowIds(value);