feat: add ShowIcon property.

This commit is contained in:
Zhang Dian
2024-09-11 19:32:13 +08:00
parent c1e58d5e71
commit 621f55674c
12 changed files with 72 additions and 43 deletions

View File

@@ -11,6 +11,7 @@ public partial class NotificationDemoViewModel : ObservableObject
{
public WindowNotificationManager? NotificationManager { get; set; }
[ObservableProperty] private bool _showIcon = true;
[ObservableProperty] private bool _showClose = true;
[RelayCommand]
@@ -26,27 +27,25 @@ public partial class NotificationDemoViewModel : ObservableObject
[RelayCommand]
public void ShowNormal(object obj)
{
if (obj is string s)
{
Enum.TryParse<NotificationType>(s, out var notificationType);
NotificationManager?.Show(
new Notification("Welcome", "This is message"),
showClose: ShowClose,
type: notificationType);
}
if (obj is not string s) return;
Enum.TryParse<NotificationType>(s, out var notificationType);
NotificationManager?.Show(
new Notification("Welcome", "This is message"),
showIcon: ShowIcon,
showClose: ShowClose,
type: notificationType);
}
[RelayCommand]
public void ShowLight(object obj)
{
if (obj is string s)
{
Enum.TryParse<NotificationType>(s, out var notificationType);
NotificationManager?.Show(
new Notification("Welcome", "This is message"),
showClose: ShowClose,
type: notificationType,
classes: ["Light"]);
}
if (obj is not string s) return;
Enum.TryParse<NotificationType>(s, out var notificationType);
NotificationManager?.Show(
new Notification("Welcome", "This is message"),
showIcon: ShowIcon,
showClose: ShowClose,
type: notificationType,
classes: ["Light"]);
}
}