Skip to content
ConsoleMonster
Class

ScoreGauge

ConsoleMonster.Widgets

Namespace
ConsoleMonster.Widgets
Assembly
ConsoleMonster
Implements
IWidget
Modifiers
sealed

A supplied score with a gauge and labelled components. It never computes a score or severity band.

Inheritance

  • object
  • ScoreGauge

Usage

Explore 24 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 12

Accepted by parameters 12

Constructors

public ScoreGauge(double value, double maximum = 100, ThemeToken role = Pass) #

Creates a gauge using the caller's score and finding role.

Parameters

value double required
maximum double = 100 optional
role ConsoleMonster.Styling.ThemeToken = Pass optional

Methods

public 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 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.

Properties

public double Value { get; set; } #

The engine's score.

public double Maximum { get; set; } #

The maximum score.

public ThemeToken Role { get; set; } #

The worst finding's role, supplied by the caller.

public int Width { get; set; } #

A fixed gauge width, or zero for 24 cells at wide widths and 20 at narrow widths.

public IList<KeyValuePair<string, string>> Parts { get; } #

Literal label/value components, in their supplied order.

Extension Methods

public static ScoreGauge AddPart(ScoreGauge scoreGauge, KeyValuePair<string, string> item) #

Adds an item to ScoreGauge.Parts: Literal label/value components, in their supplied order.

Parameters

scoreGauge ConsoleMonster.Widgets.ScoreGauge required
The instance.
item System.Collections.Generic.KeyValuePair<string, string> required
The item.

Returns

ScoreGauge The same instance.
AddParts 2 overloads
public static ScoreGauge AddParts(ScoreGauge scoreGauge, params KeyValuePair<string, string>[] items) #

Adds items to ScoreGauge.Parts: Literal label/value components, in their supplied order.

Parameters

scoreGauge ConsoleMonster.Widgets.ScoreGauge required
The instance.
items System.Collections.Generic.KeyValuePair<string, string>[] required
The items, in order.

Returns

ScoreGauge The same instance.
public static ScoreGauge AddParts(ScoreGauge scoreGauge, IEnumerable<KeyValuePair<string, string>> items) #

Adds items to ScoreGauge.Parts: Literal label/value components, in their supplied order.

Parameters

scoreGauge ConsoleMonster.Widgets.ScoreGauge required
The instance.
items System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string, string>> required
The items, in order.

Returns

ScoreGauge The same instance.
public static ScoreGauge Maximum(ScoreGauge scoreGauge, double value) #

Sets ScoreGauge.Maximum: The maximum score.

Parameters

scoreGauge ConsoleMonster.Widgets.ScoreGauge required
The instance.
value double required
The value.

Returns

ScoreGauge The same instance.

Examples

// C# initializer or property    // C# fluent
scoreGauge.Maximum = value;      scoreGauge.Maximum(value);
public static ScoreGauge Role(ScoreGauge scoreGauge, ThemeToken value) #

Sets ScoreGauge.Role: The worst finding's role, supplied by the caller.

Parameters

scoreGauge ConsoleMonster.Widgets.ScoreGauge required
The instance.
value ConsoleMonster.Styling.ThemeToken required
The value.

Returns

ScoreGauge The same instance.

Examples

// C# initializer or property    // C# fluent
scoreGauge.Role = value;         scoreGauge.Role(value);
public static ScoreGauge Value(ScoreGauge scoreGauge, double value) #

Sets ScoreGauge.Value: The engine's score.

Parameters

scoreGauge ConsoleMonster.Widgets.ScoreGauge required
The instance.
value double required
The value.

Returns

ScoreGauge The same instance.

Examples

// C# initializer or property    // C# fluent
scoreGauge.Value = value;        scoreGauge.Value(value);
public static ScoreGauge Width(ScoreGauge scoreGauge, int value) #

Sets ScoreGauge.Width: A fixed gauge width, or zero for 24 cells at wide widths and 20 at narrow widths.

Parameters

scoreGauge ConsoleMonster.Widgets.ScoreGauge required
The instance.
value int required
The value.

Returns

ScoreGauge The same instance.

Examples

// C# initializer or property    // C# fluent
scoreGauge.Width = value;        scoreGauge.Width(value);