Skip to main content

Notifications class

Namespace: Arlecchino.Diagnostics · Assembly: Arlecchino

What the application has to say, and for how long. The newest line sits on the output row until it times out and stays in the list much longer, on two timeouts the Ticker counts.

public sealed class Notifications

Constructors

MemberSummary
Notifications(ArlecchinoOptions, TimeProvider, Ticker)Creates the list.

Properties

MemberSummary
CapacityHow many messages to keep at most, however young they are. A list bounded only by time grows without limit when something reports in a loop, so the oldest fall off once this many are held.
CurrentThe line the output row shows, or null once it has timed out. The entry itself stays in Notifications.Entries until the longer timeout takes it.
EntriesEverything still held, the newest first.
RecentWhat is worth showing right now, the newest first: everything still running, whatever its age, and everything that ended recently enough not to have timed out.

Methods

MemberSummary
Clear()Throws away everything that has been said, the output row included, except work that is still running. Clearing a line does not stop the work behind it.
Notify(string, NotificationLevel)Says something. The newest line replaces whatever the output row was showing.
Raise(Notification)Says something that carries more than a line: work still running, a report to read in full, something to do about it. The caller builds the entry, so it can take it back with Notifications.Withdraw.
Settle(Notification, string, NotificationLevel)Turns a line that was reporting work into what came of that work, in place. The entry keeps its spot and its identity, so an open dialog changes rather than going stale.
Withdraw(Notification)Takes one entry back, for work whose line should not be kept at all.

Constructors in detail

Notifications(ArlecchinoOptions, TimeProvider, Ticker)

public Notifications(ArlecchinoOptions options, TimeProvider time, Ticker ticker);

Creates the list.

Parameters

NameTypeDescription
optionsArlecchinoOptionsSupplies both timeouts.
timeTimeProviderWhere the current time comes from.
tickerTickerCounts the timeouts between frames.

Properties in detail

Capacity

public int Capacity { get; set; }

How many messages to keep at most, however young they are. A list bounded only by time grows without limit when something reports in a loop, so the oldest fall off once this many are held.

Type int

Current

public Notification? Current { get; }

The line the output row shows, or null once it has timed out. The entry itself stays in Notifications.Entries until the longer timeout takes it.

Type Notification

Entries

public IReadOnlyList<Notification> Entries { get; }

Everything still held, the newest first.

Type IReadOnlyList<T><Notification>

Recent

public IReadOnlyList<Notification> Recent { get; }

What is worth showing right now, the newest first: everything still running, whatever its age, and everything that ended recently enough not to have timed out.

Type IReadOnlyList<T><Notification>

Methods in detail

Clear()

public void Clear();

Throws away everything that has been said, the output row included, except work that is still running. Clearing a line does not stop the work behind it.

Notify(string, NotificationLevel)

public void Notify(string text, NotificationLevel level = Information);

Says something. The newest line replaces whatever the output row was showing.

Parameters

NameTypeDescription
textstringWhat to say; an empty string clears the row instead.
levelNotificationLevelHow loud it is.

Raise(Notification)

public Notification Raise(Notification entry);

Says something that carries more than a line: work still running, a report to read in full, something to do about it. The caller builds the entry, so it can take it back with Notifications.Withdraw.

Parameters

NameTypeDescription
entryNotificationThe notification to raise.

Returns Notification — The same entry, so a caller can hold on to it in one expression.

Settle(Notification, string, NotificationLevel)

public void Settle(Notification entry, string text, NotificationLevel level = Information);

Turns a line that was reporting work into what came of that work, in place. The entry keeps its spot and its identity, so an open dialog changes rather than going stale.

Parameters

NameTypeDescription
entryNotificationThe entry that was reporting.
textstringWhat came of the work.
levelNotificationLevelHow loud that is.

Withdraw(Notification)

public void Withdraw(Notification entry);

Takes one entry back, for work whose line should not be kept at all.

Parameters

NameTypeDescription
entryNotificationThe entry to remove; one that is no longer held is ignored.