Class ToastLifetime
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
How long a toast stays, how much of that is left, and how opaque it is right now.
public sealed class ToastLifetime
- Inheritance
-
ToastLifetime
- Inherited Members
Remarks
The clock of one toast, with no window in it. The window used to carry this in a one-shot timer that nothing could pause, read or test; a bar that shrinks, a pause while the pointer is over the card and a fade at both ends all need the same three numbers, so they live here and the window only draws them.
Frame by frame from a plain timer rather than a declared animation: the toast has a handful of seconds to live and an animation that freezes halfway would leave a card on screen that nothing ever closes.
Constructors
ToastLifetime(NotificationLevel)
public ToastLifetime(NotificationLevel level)
Parameters
levelNotificationLevel
Fields
Fade
The fade at each end.
public static readonly TimeSpan Fade
Field Value
Normal
How long an ordinary toast stays.
public static readonly TimeSpan Normal
Field Value
Serious
How long a toast about something broken stays: long enough to read twice.
public static readonly TimeSpan Serious
Field Value
Properties
Duration
The whole time this toast stays, not counting pauses.
public TimeSpan Duration { get; }
Property Value
Elapsed
How much of Duration has gone.
public TimeSpan Elapsed { get; }
Property Value
Expired
True once the time is up and the toast should close.
public bool Expired { get; }
Property Value
Opacity
The opacity to draw with: fading in at the start and out at the end.
public double Opacity { get; }
Property Value
Paused
True while the pointer is over the card: the clock does not move.
public bool Paused { get; set; }
Property Value
Remarks
Pausing in the last moments steps the clock back to where the fade-out starts, so a card the pointer arrives on while it is already half faded comes back solid instead of stopping transparent.
Remaining
The share of the time still left, from 1 down to 0: the width of the bar.
public double Remaining { get; }
Property Value
Methods
Advance(TimeSpan)
Moves the clock on by step, unless it is paused.
public void Advance(TimeSpan step)
Parameters
stepTimeSpan
DurationFor(NotificationLevel)
The time a toast of this level stays: longer when something is broken.
public static TimeSpan DurationFor(NotificationLevel level)
Parameters
levelNotificationLevel