Notification class
Namespace: Arlecchino.Diagnostics · Assembly: Arlecchino
One thing the application said, and when it said it. Work still running fills in Notification.ProgressText, and anything longer fills in Notification.Detail and Notification.Actions.
public sealed class Notification
Constructors
| Member | Summary |
|---|---|
Notification(DateTimeOffset, NotificationLevel, string) | Raises an entry, which is as much as a plain message ever needs. |
Properties
| Member | Summary |
|---|---|
Actions | What can be done about it, offered when the entry is opened. Work that has ended clears these, since stopping something that is over is not an offer worth making. |
Detail | The whole story, shown when the entry is opened: the errors a copy collected, the output of a command, the stack of what failed. Falls back to Notification.Text when it is not set. |
EndedText | What came of the work, once it ended. Set through Notifications.Settle. |
IsRunning | Whether the work this entry reports is still going. |
Level | How loud it is now: what it was raised as, or what it turned out to be once the work it reports ended — a copy that starts as a plain message and finds three files locked says so. |
Line | The single line to draw: what came of it, what is happening now, or what was said. |
Progress | How far along the work is, from 0 to 1, read every frame beside Notification.ProgressText. A bar is drawn for it wherever the entry is shown; work whose size is not known answers null and gets the text alone. |
ProgressText | The line to show while something is still running, read every frame. Left alone for anything that is already over, which is most notifications. |
RaisedAt | When the entry last had something new to say — raised, or ended. Work that ran for an hour is not stale the moment it finishes, so the timeouts are counted from here rather than from the moment it was raised. |
Text | What it was raised saying, kept as it was written. Notification.Line is the line to draw, which is this one only while nothing newer has been said. |
Methods
| Member | Summary |
|---|---|
Fraction() | How full a bar for this entry should be, or null when there is nothing to draw. |
Whole() | The full text to read: Notification.Detail when there is one, the line otherwise. |
Constructors in detail
Notification(DateTimeOffset, NotificationLevel, string)
public Notification(DateTimeOffset raisedAt, NotificationLevel level, string text);
Raises an entry, which is as much as a plain message ever needs.
Parameters
| Name | Type | Description |
|---|---|---|
raisedAt | DateTimeOffset | When it was raised. |
level | NotificationLevel | How loud it is. |
text | string | What it says in one line. |
Properties in detail
Actions
public IReadOnlyList<NotificationAction> Actions { get; set; }
What can be done about it, offered when the entry is opened. Work that has ended clears these, since stopping something that is over is not an offer worth making.
Type IReadOnlyList<T><NotificationAction>
Detail
public Func<string>? Detail { get; set; }
The whole story, shown when the entry is opened: the errors a copy collected, the output of a command, the stack of what failed. Falls back to Notification.Text when it is not set.
Type Func<TResult><string>
EndedText
public string? EndedText { get; }
What came of the work, once it ended. Set through Notifications.Settle.
Type string
IsRunning
public bool IsRunning { get; }
Whether the work this entry reports is still going.
Type bool
Level
public NotificationLevel Level { get; }
How loud it is now: what it was raised as, or what it turned out to be once the work it reports ended — a copy that starts as a plain message and finds three files locked says so.
Type NotificationLevel
Line
public string Line { get; }
The single line to draw: what came of it, what is happening now, or what was said.
Type string
Progress
public Func<Nullable<double>> Progress { get; init; }
How far along the work is, from 0 to 1, read every frame beside Notification.ProgressText. A bar is drawn for it wherever the entry is shown; work whose size is not known answers null and gets the text alone.
Type Func<TResult><Nullable<T><double>>
ProgressText
public Func<string>? ProgressText { get; init; }
The line to show while something is still running, read every frame. Left alone for anything that is already over, which is most notifications.
Type Func<TResult><string>
RaisedAt
public DateTimeOffset RaisedAt { get; }
When the entry last had something new to say — raised, or ended. Work that ran for an hour is not stale the moment it finishes, so the timeouts are counted from here rather than from the moment it was raised.
Type DateTimeOffset
Text
public string Text { get; }
What it was raised saying, kept as it was written. Notification.Line is the line to draw, which is this one only while nothing newer has been said.
Type string
Methods in detail
Fraction()
public Nullable<double> Fraction();
How full a bar for this entry should be, or null when there is nothing to draw.
Returns Nullable<T><double> — A fraction between 0 and 1.
Whole()
public string Whole();
The full text to read: Notification.Detail when there is one, the line otherwise.
Returns string — What to show in the dialog.