Files
Lattice/Lattice.Core/Services/NotificationService.cs
2026-01-07 23:54:00 +03:00

19 lines
709 B
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Lattice.Core.Abstractions;
using Lattice.Core.Models;
using Lattice.Core.Models.Enums;
namespace Lattice.Core.Services;
/// <summary>
/// Простая реализация сервиса уведомлений.
/// Хранит только событие и вызывает его при Show().
/// </summary>
public sealed class NotificationService : INotificationService
{
public event EventHandler<NotificationEventArgs>? NotificationReceived;
public void Show(string message, NotificationSeverity severity = NotificationSeverity.Info, int durationSeconds = 5)
{
NotificationReceived?.Invoke(this, new NotificationEventArgs(message, severity, durationSeconds));
}
}