Class ToastContent
- Namespace
- SharpConsoleUI.Controls
- Assembly
- SharpConsoleUI.dll
A transient toast overlay rendered as a desktop portal. Role-themed; INPC-reactive.
public sealed class ToastContent : PortalContentBase, IContainer, IDOMPaintable, IMouseAwareControl, IWindowControl, IDisposable, IHasPortalBounds, IColorRoleableControl, INotifyPropertyChanged
- Inheritance
-
ToastContent
- Implements
- Inherited Members
- Extension Methods
Constructors
ToastContent(string, NotificationSeverity, ColorRole)
Initializes a new ToastContent with the given message, severity, and color role.
public ToastContent(string message, NotificationSeverity severity, ColorRole role)
Parameters
messagestringThe message text to display.
severityNotificationSeverityThe severity level supplying the icon and accent color.
roleColorRoleThe semantic color role used for theming.
Properties
ColorRole
The semantic color role. Default = no role (normal resolution).
public ColorRole ColorRole { get; set; }
Property Value
ColorRoleMode
Optional ThemeMode override for role-colour derivation. When non-null, the role's dark/light seed colours are resolved as if the theme were in this mode, regardless of the theme's own Mode. When null (the default), the active theme's mode is used.
public ThemeMode? ColorRoleMode { get; set; }
Property Value
Message
Gets or sets the message text shown in the toast.
public string Message { get; set; }
Property Value
Outline
When true and a role is set, renders outline style (role color on text + border, surface fill).
public bool Outline { get; set; }
Property Value
Severity
Gets or sets the severity supplying the icon and accent color.
public NotificationSeverity Severity { get; set; }
Property Value
Sticky
Gets or sets whether the toast is sticky (does not auto-dismiss).
public bool Sticky { get; set; }
Property Value
Methods
GetPortalBounds()
Returns the absolute position and size for this portal overlay. Subclasses must implement this to provide their bounds.
public override Rectangle GetPortalBounds()
Returns
PaintPortalContent(CharacterBuffer, LayoutRect, LayoutRect, Color, Color)
Paints the rounded toast box with a severity-role border and a matching inner accent bar.
protected override void PaintPortalContent(CharacterBuffer buffer, LayoutRect bounds, LayoutRect clipRect, Color defaultFg, Color defaultBg)
Parameters
bufferCharacterBufferboundsLayoutRectclipRectLayoutRectdefaultFgColordefaultBgColor
ProcessMouseEvent(MouseEventArgs)
Processes a mouse event. When BorderStyle is set, coordinates are already adjusted for the border offset.
public override bool ProcessMouseEvent(MouseEventArgs args)
Parameters
argsMouseEventArgs
Returns
SetBounds(Rectangle)
Set by ToastService from the toast's stacking slot.
public void SetBounds(Rectangle bounds)
Parameters
boundsRectangle
Events
PropertyChanged
Occurs when a property value changes.
public event PropertyChangedEventHandler? PropertyChanged