-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAppNotification.cs
More file actions
30 lines (28 loc) · 1.15 KB
/
AppNotification.cs
File metadata and controls
30 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
namespace ToastDesk;
public sealed class AppNotification
{
public AppNotification(
string title,
string message,
NotificationOrigin origin,
string? sourceAppName = null,
string? sourceAppUserModelId = null)
{
Id = Guid.NewGuid();
Title = string.IsNullOrWhiteSpace(title) ? "Notification" : title.Trim();
Message = string.IsNullOrWhiteSpace(message) ? "(No message body)" : message.Trim();
Origin = origin;
SourceAppName = string.IsNullOrWhiteSpace(sourceAppName) ? null : sourceAppName.Trim();
SourceAppUserModelId = string.IsNullOrWhiteSpace(sourceAppUserModelId) ? null : sourceAppUserModelId.Trim();
CreatedAt = DateTimeOffset.Now;
}
public Guid Id { get; }
public string Title { get; }
public string Message { get; }
public NotificationOrigin Origin { get; }
public string? SourceAppName { get; }
public string? SourceAppUserModelId { get; }
public string SourceDisplayName => SourceAppName ?? Origin.ToString();
public DateTimeOffset CreatedAt { get; }
public string CreatedAtLocalText => CreatedAt.ToString("HH:mm:ss");
}