Skip to content
ConsoleMonster
Class

WatchView

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Modifiers
sealed

The view of a command run again and again (ConsoleWatch, Watch-Console): a heading with the interval, the title, the run number and the time of the last run, then the latest output. With WatchView.Differences, each value (a table cell, a word or number) that changed since the previous run is shown bold on a soft surface tone, over its own colours, until a run leaves it unchanged; without colour a marker before it (↑, ↓ or *) says so. Live operation: update (Payload = the new content widget, Value = the run number, Text = a status such as an error message, or null).

Inheritance

Usage

Explore 13 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 7

Accepted by parameters 6

Constructors

public WatchView(string widgetId = "watch") #

Creates a watch view.

Parameters

widgetId string = "watch" optional
The live name (default watch).

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 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 WatchView Update(IWidget content, int iteration, string? status = null, DateTimeOffset? time = null) #

Shows the output of a new run; the previous output becomes the base for WatchView.Differences.

Parameters

content ConsoleMonster.Layout.IWidget required
The new content.
iteration int required
The run number.
status string? = null optional
A status (an error message), or null.
time System.DateTimeOffset? = null optional
The time of the run, or null for now.

Returns

WatchView This instance.

Properties

public string? Title { get; set; } #

What is being watched, shown in the heading (markup), or null.

public TimeSpan PollInterval { get; set; } #

The time between runs, shown in the heading.

public bool Differences { get; set; } #

Whether values that changed since the previous run are highlighted (bold on a soft surface; a marker without colour).

public int Iteration { get; private set; } #

The number of the latest run (1 for the first).

public string? Status { get; private set; } #

A status shown after the heading (an error of the last run), or null.

Extension Methods

public static WatchView Differences(WatchView watchView, bool value = true) #

Sets WatchView.Differences: Whether values that changed since the previous run are highlighted (bold on a soft surface; a marker without colour).

Parameters

watchView ConsoleMonster.Widgets.WatchView required
The instance.
value bool = true optional
The value; true when omitted.

Returns

WatchView The same instance.

Examples

// C# initializer or property                                            // C# fluent
new global::ConsoleMonster.Widgets.WatchView { Differences = value };    watchView.Differences(value);
public static WatchView PollInterval(WatchView watchView, TimeSpan value) #

Sets WatchView.PollInterval: The time between runs, shown in the heading.

Parameters

watchView ConsoleMonster.Widgets.WatchView required
The instance.
value System.TimeSpan required
The value.

Returns

WatchView The same instance.

Examples

// C# initializer or property                                             // C# fluent
new global::ConsoleMonster.Widgets.WatchView { PollInterval = value };    watchView.PollInterval(value);
public static WatchView Title(WatchView watchView, string? value) #

Sets WatchView.Title: What is being watched, shown in the heading (markup), or null.

Parameters

watchView ConsoleMonster.Widgets.WatchView required
The instance.
value string? required
The value.

Returns

WatchView The same instance.

Examples

// C# initializer or property                                      // C# fluent
new global::ConsoleMonster.Widgets.WatchView { Title = value };    watchView.Title(value);