feat: add Light class to NotificationCard.

This commit is contained in:
Zhang Dian
2024-08-14 20:00:43 +08:00
parent 38b9494aaf
commit a328e2bb99
4 changed files with 117 additions and 55 deletions

View File

@@ -22,13 +22,35 @@ public partial class NotificationDemo : UserControl
_manager = new WindowNotificationManager(topLevel) { MaxItems = 3 };
}
private void InfoButton_OnClick(object? sender, RoutedEventArgs e)
private void NormalButton_OnClick(object? sender, RoutedEventArgs e)
{
if (sender is Button b && b.Content is string s)
{
_manager?.Show(Enum.TryParse<NotificationType>(s, out NotificationType t)
_manager?.Show(Enum.TryParse<NotificationType>(s, out var t)
? new Notification(t.ToString(), "This is message", t)
: new Notification(s, "This is message"));
}
}
private void PositionButton_OnClick(object? sender, RoutedEventArgs e)
{
if (sender is Button b && b.Content is string s)
{
Enum.TryParse<NotificationPosition>(s, out var t);
_manager.Position = t;
_manager?.Show(new Notification(t.ToString(), "This is message"));
}
}
private void LightButton_OnClick(object? sender, RoutedEventArgs e)
{
if (sender is Button b && b.Content is string s)
{
Enum.TryParse<NotificationType>(s, out var notificationType);
_manager?.Show(
new Notification(notificationType.ToString(), "This is message"),
type: notificationType,
classes: ["Light"]);
}
}
}