| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="NotificationBase.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System; |
| | | 8 | | using MyNet.Observable; |
| | | 9 | | using MyNet.Primitives; |
| | | 10 | | using MyNet.UI.Toasting.Settings; |
| | | 11 | | |
| | | 12 | | namespace MyNet.UI.Notifications.Models; |
| | | 13 | | |
| | | 14 | | /// <summary> |
| | | 15 | | /// Represents the base class for notifications, providing common properties and functionality for all types of notifica |
| | | 16 | | /// </summary> |
| | | 17 | | /// <param name="message">The message content of the notification.</param> |
| | | 18 | | /// <param name="title">The title of the notification.</param> |
| | | 19 | | /// <param name="severity">The severity level of the notification.</param> |
| | 162 | 20 | | public abstract class NotificationBase(string message, string? title = "", NotificationSeverity severity = NotificationS |
| | | 21 | | : ObservableObject, INotification, IHasToastSettings |
| | | 22 | | { |
| | | 23 | | /// <inheritdoc/> |
| | | 24 | | public Guid Id { get; } = Guid.NewGuid(); |
| | | 25 | | |
| | | 26 | | /// <inheritdoc/> |
| | 162 | 27 | | public string Title { get; } = title.OrEmpty(); |
| | | 28 | | |
| | | 29 | | /// <inheritdoc/> |
| | | 30 | | public string Message { get; } = message; |
| | | 31 | | |
| | | 32 | | /// <inheritdoc/> |
| | | 33 | | public NotificationSeverity Severity { get; } = severity; |
| | | 34 | | |
| | | 35 | | /// <inheritdoc/> |
| | | 36 | | public DateTime Timestamp { get; } = DateTime.UtcNow; |
| | | 37 | | |
| | | 38 | | /// <inheritdoc /> |
| | | 39 | | public ToastSettingsOverrides? ToastSettings { get; init; } |
| | | 40 | | |
| | | 41 | | /// <inheritdoc/> |
| | 0 | 42 | | public override string ToString() => Message; |
| | | 43 | | } |
| | | 44 | | |