Class TwToastService
Service for managing toast notifications.
public sealed class TwToastService : ITwToastService, IDisposable
- Inheritance
-
TwToastService
- Implements
- Inherited Members
- Extension Methods
Constructors
TwToastService()
Initializes a new instance of the TwToastService class.
public TwToastService()
Properties
HasToasts
Gets whether there are any active toasts.
public bool HasToasts { get; }
Property Value
Methods
AddToast(ToastModel)
Adds a new toast notification.
public void AddToast(ToastModel toast)
Parameters
toastToastModelThe toast to add.
ClearAll()
Clears all active toasts.
public void ClearAll()
ClearToast(ToastModel)
Removes a specific toast notification.
public void ClearToast(ToastModel toast)
Parameters
toastToastModelThe toast to remove.
Dispose()
Disposes the service and releases resources.
public void Dispose()
GetToasts()
Gets the current list of active toasts.
public List<ToastModel> GetToasts()
Returns
- List<ToastModel>
List of active toast notifications.
PauseToastForFocus(Guid)
Marks a toast as having keyboard focus, pausing its auto-dismiss timer.
public void PauseToastForFocus(Guid toastId)
Parameters
Remarks
Hover and focus are tracked independently (see PauseToastForHover(Guid)) so that a toast still being hovered doesn't have its timer resumed just because keyboard focus left it.
PauseToastForHover(Guid)
Marks a toast as hovered by the pointer, pausing its auto-dismiss timer.
public void PauseToastForHover(Guid toastId)
Parameters
Remarks
Hover and focus are tracked independently (see PauseToastForFocus(Guid)) so that a toast which still has keyboard focus doesn't have its timer resumed just because the pointer moved away.
ResumeToastForFocus(Guid)
Marks a toast as no longer having keyboard focus, resuming its auto-dismiss timer only if the pointer also isn't currently hovering the toast.
public void ResumeToastForFocus(Guid toastId)
Parameters
ResumeToastForHover(Guid)
Marks a toast as no longer hovered by the pointer, resuming its auto-dismiss timer only if the toast also doesn't currently have keyboard focus.
public void ResumeToastForHover(Guid toastId)
Parameters
Events
ToasterChanged
Event raised when the toast collection changes.
public event EventHandler? ToasterChanged
Event Type
ToasterTimerElapsed
Event raised when the clean-up timer elapses.
public event EventHandler? ToasterTimerElapsed