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
| Member | Summary |
|---|---|
Notifications(ArlecchinoOptions, TimeProvider, Ticker) | Creates the list. |
Properties
| Member | Summary |
|---|---|
Capacity | 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. |
Current | 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. |
Entries | Everything still held, the newest first. |
Recent | 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. |
Methods
| Member | Summary |
|---|---|
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
| Name | Type | Description |
|---|---|---|
options | ArlecchinoOptions | Supplies both timeouts. |
time | TimeProvider | Where the current time comes from. |
ticker | Ticker | Counts 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
| Name | Type | Description |
|---|---|---|
text | string | What to say; an empty string clears the row instead. |
level | NotificationLevel | How 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
| Name | Type | Description |
|---|---|---|
entry | Notification | The 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
| Name | Type | Description |
|---|---|---|
entry | Notification | The entry that was reporting. |
text | string | What came of the work. |
level | NotificationLevel | How 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
| Name | Type | Description |
|---|---|---|
entry | Notification | The entry to remove; one that is no longer held is ignored. |