Toasts: non-blocking notifications replace MessageBoxes + log-only failures (TASK 24)

This commit is contained in:
2026-08-23 12:25:04 -07:00
parent 809c066184
commit b400ab59c5
12 changed files with 369 additions and 50 deletions
+34
View File
@@ -0,0 +1,34 @@
namespace ytLive.Services;
/// <summary>How urgent a user-facing notification is. Drives the toast's tint and lifetime.</summary>
public enum AppNotificationSeverity
{
Info,
Success,
Warning,
Error,
}
/// <summary>
/// Non-blocking user-facing messages (toasts). VMs and services raise events through
/// this seam so failures surface without MessageBox calls blocking the UI thread.
/// </summary>
public interface INotificationService
{
void Show(string title, string message, AppNotificationSeverity severity);
}
public static class NotificationServiceExtensions
{
public static void Info(this INotificationService service, string title, string message = "")
=> service.Show(title, message, AppNotificationSeverity.Info);
public static void Success(this INotificationService service, string title, string message = "")
=> service.Show(title, message, AppNotificationSeverity.Success);
public static void Warning(this INotificationService service, string title, string message = "")
=> service.Show(title, message, AppNotificationSeverity.Warning);
public static void Error(this INotificationService service, string title, string message = "")
=> service.Show(title, message, AppNotificationSeverity.Error);
}