Skip to content
ConsoleMonster

API Reference

Class

PresenterContext

Namespace ConsoleMonster.Presenters
Assembly ConsoleMonster
Modifiers sealed

Everything a presenter may depend on, so output is deterministic for a given culture, clock and terminal.

Inheritance

  • Object
  • PresenterContext

Usage

Explore 23 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 20

Constructors

public PresenterContext(RenderContext render, CultureInfo? culture = null, DateTimeOffset? now = null, TimeZoneInfo? timeZone = null) #

Creates a presenter context.

Parameters

render ConsoleMonster.Canvas.RenderContext requiredposition: 0
The render context (profile, theme, glyphs).
culture System.Globalization.CultureInfo? = null optionalposition: 1
The culture for numbers and dates, or null for the render culture (RenderContext.Culture).
now System.DateTimeOffset? = null optionalposition: 2
The reference time for relative dates, or null for the current time.
timeZone System.TimeZoneInfo? = null optionalposition: 3
The time zone for absolute dates, or null for local time.

Methods

public static Int32 DecimalsNeeded(Object? value) #
Returns: Int32

The decimals a number needs once rounded to two: 0 for whole numbers, 1 for 11.7, 2 for 3.14159 (numeric text such as "1.5" counts by its digits). Integer types, and numbers too large to carry fractions, need none.

Parameters

value System.Object? requiredposition: 0
The raw value.

Returns

0, 1 or 2; 0 for non-numbers.

public PresenterContext WithColumn(Double? maximum, Int32? decimals) #
Returns: PresenterContext

Returns a copy with column statistics: the largest value and the decimals the column's numbers share.

Parameters

maximum System.Double? requiredposition: 0
The maximum, or null.
decimals System.Int32? requiredposition: 1
The shared decimals, or null.

Returns

The copy.

public PresenterContext WithColumnMaximum(Double? maximum) #
Returns: PresenterContext

Returns a copy with a column maximum.

Parameters

maximum System.Double? requiredposition: 0
The maximum.

Returns

The copy.

Properties

public RenderContext Render { get; } #

The render context.

public CultureInfo Culture { get; } #

The culture for numbers (thousand separators, decimals) and dates.

public DateTimeOffset Now { get; } #

The reference time for relative dates.

public TimeZoneInfo TimeZone { get; } #

The time zone absolute dates are shown in.

public Double? ColumnMaximum { get; set; } #

The largest numeric value in the column (data bars scale to it), or null.

public Int32? ColumnDecimals { get; set; } #

The decimals every number in the column is shown with (the most any of its values needs, at most two), so the decimal separators line up; null outside a column, where each number shows up to two decimals of its own.

public Boolean HasColor { get; } #

Whether the output can carry colour; without it, tones are expressed with symbols and words.