Class NotificationCatalog
- Namespace
- McServerLauncher.Services
- Assembly
- McServerLauncher.dll
What each kind of notification looks like: its level, and the icon that identifies it.
public static class NotificationCatalog
- Inheritance
-
NotificationCatalog
- Inherited Members
Remarks
Built like ServerTypeCatalog, and for the same reason: the table holds data and nothing from any UI framework's controls, so it can be read by a test, and adding a kind is a row rather than an edit in three files. The colours themselves are not here — they are a user setting, and live in NotificationSettings.
The icon is a FluentIcons.Common.Symbol, which is only a name: the same enum the rest of the app draws its icons from, so a toast looks like the window it came from. The point of the marks is that "somebody joined" and "the server crashed" can be told apart without reading, and shape does that where colour alone leaves out anybody who cannot separate red from green — which is why no two kinds share one.
Fields
All
Every kind, with its level and mark.
public static readonly IReadOnlyList<NotificationCatalog.Entry> All
Field Value
Remarks
The levels answer one question: is the server serving players, or is it not? Green when it is (somebody arrived, it woke up), grey-blue when nothing changed either way (somebody left or died), amber when it is down on purpose, red when it is down and did not mean to be. The escalation from amber to red is the one worth having: a server that stopped itself because nobody was on it and a server that crashed are both "not running", and they need completely different reactions.
Methods
For(NotificationKind)
The entry for a kind. Falls back to a neutral one rather than throwing.
public static NotificationCatalog.Entry For(NotificationKind kind)
Parameters
kindNotificationKind
Returns
Remarks
A notification that cannot be styled is still a notification worth showing: refusing to
display "the server crashed" because nobody added it to this table would be the worst
possible trade. EveryKindIsInTheCatalogue is what stops it silently coming to that.
HeadingKey(NotificationKind)
The resource key of the line that names a kind at the top of its toast ("Player joined").
public static string HeadingKey(NotificationKind kind)
Parameters
kindNotificationKind
Returns
Remarks
A key rather than the text, so this stays free of the localizer; the caller looks it up. It is
built from the kind's name, which is why LocalizationTests lists the prefix among the
keys that are made up at run time.
IconOf(NotificationKind)
The icon shown for a kind.
public static Symbol IconOf(NotificationKind kind)
Parameters
kindNotificationKind
Returns
- Symbol
LevelOf(NotificationKind)
The level a kind is shown at.
public static NotificationLevel LevelOf(NotificationKind kind)
Parameters
kindNotificationKind