Добавлен Studio
This commit is contained in:
19
Lattice.Core/Services/NotificationService.cs
Normal file
19
Lattice.Core/Services/NotificationService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user