feat: add ShowIcon property.
This commit is contained in:
@@ -12,7 +12,10 @@
|
||||
<vm:NotificationDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<StackPanel Spacing="20">
|
||||
<ToggleSwitch IsChecked="{Binding ShowClose}" Content="ShowClose" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ToggleSwitch IsChecked="{Binding ShowIcon}" Content="ShowIcon" />
|
||||
<ToggleSwitch IsChecked="{Binding ShowClose}" Content="ShowClose" />
|
||||
</StackPanel>
|
||||
|
||||
<UniformGrid Rows="2" Columns="3" Width="500" HorizontalAlignment="Left">
|
||||
<UniformGrid.Styles>
|
||||
|
||||
@@ -12,7 +12,10 @@
|
||||
<vm:ToastDemoViewModel />
|
||||
</Design.DataContext>
|
||||
<StackPanel Spacing="20">
|
||||
<ToggleSwitch IsChecked="{Binding ShowClose}" Content="ShowClose" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ToggleSwitch IsChecked="{Binding ShowIcon}" Content="ShowIcon" />
|
||||
<ToggleSwitch IsChecked="{Binding ShowClose}" Content="ShowClose" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
||||
<StackPanel.Styles>
|
||||
|
||||
@@ -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"]);
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ public partial class ToastDemoViewModel : ObservableObject
|
||||
{
|
||||
public WindowToastManager? ToastManager { get; set; }
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _showClose = true;
|
||||
[ObservableProperty] private bool _showIcon = true;
|
||||
[ObservableProperty] private bool _showClose = true;
|
||||
|
||||
[RelayCommand]
|
||||
public void ShowNormal(object obj)
|
||||
@@ -21,6 +21,7 @@ public partial class ToastDemoViewModel : ObservableObject
|
||||
Enum.TryParse<NotificationType>(s, out var notificationType);
|
||||
ToastManager?.Show(
|
||||
new Toast("This is message"),
|
||||
showIcon: ShowIcon,
|
||||
showClose: ShowClose,
|
||||
type: notificationType);
|
||||
}
|
||||
@@ -40,6 +41,7 @@ public partial class ToastDemoViewModel : ObservableObject
|
||||
Enum.TryParse<NotificationType>(s, out var notificationType);
|
||||
ToastManager?.Show(
|
||||
new Toast("This is message"),
|
||||
showIcon: ShowIcon,
|
||||
showClose: ShowClose,
|
||||
type: notificationType,
|
||||
classes: ["Light"]);
|
||||
|
||||
Reference in New Issue
Block a user