Table of Contents

Class ToastService

Namespace
McServerLauncher.Views
Assembly
McServerLauncher.dll

Small toast notifications drawn as borderless always-on-top windows in the bottom-right corner of the screen (pure Avalonia, no external dependencies, works even while the main window is hidden in the tray). They never steal focus, auto-dismiss after a few seconds, and clicking one restores the main window. Used for "player joined" / "server crashed" style events.

public sealed class ToastService
Inheritance
ToastService
Inherited Members

Fields

Shared

public static readonly ToastService Shared

Field Value

ToastService

Properties

MainWindowInactive

True when nobody is looking at the app (window hidden in the tray, minimized or just not focused) — the situations in which a toast is actually useful.

public static bool MainWindowInactive { get; }

Property Value

bool

Methods

Notify(string, string, NotificationLevel, string, NotificationSettings?)

Shows a toast (thread-safe; marshals to the UI thread).

public void Notify(string title, string message, NotificationLevel level = NotificationLevel.Info, string emoji = "", NotificationSettings? colours = null)

Parameters

title string
message string
level NotificationLevel
emoji string
colours NotificationSettings

Remarks

The level and the mark are passed in rather than worked out here, because what a toast means is not something the window that draws it can know. Every toast used to look identical — the same panel with the same faint green border whether somebody had joined or the server had died — so the only way to tell them apart was to stop and read.