csharpc-sharpdotnetxamlavaloniauicross-platformcross-platform-xamlavaloniaguimulti-platformuser-interfacedotnetcore
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.7 KiB
44 lines
1.7 KiB
using Avalonia.Controls.Notifications;
|
|
using MiniMvvm;
|
|
|
|
namespace ControlCatalog.ViewModels
|
|
{
|
|
public class NotificationViewModel
|
|
{
|
|
public WindowNotificationManager? NotificationManager { get; set; }
|
|
|
|
public NotificationViewModel()
|
|
{
|
|
ShowCustomManagedNotificationCommand = MiniCommand.Create(() =>
|
|
{
|
|
NotificationManager?.Show(new NotificationViewModel() { Title = "Hey There!", Message = "Did you know that Avalonia now supports Custom In-Window Notifications?" , NotificationManager = NotificationManager}, NotificationType.Warning);
|
|
});
|
|
|
|
ShowManagedNotificationCommand = MiniCommand.Create(() =>
|
|
{
|
|
NotificationManager?.Show(new Avalonia.Controls.Notifications.Notification("Welcome", "Avalonia now supports Notifications.", NotificationType.Information));
|
|
});
|
|
|
|
YesCommand = MiniCommand.Create(() =>
|
|
{
|
|
NotificationManager?.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today."));
|
|
});
|
|
|
|
NoCommand = MiniCommand.Create(() =>
|
|
{
|
|
NotificationManager?.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit..."));
|
|
});
|
|
}
|
|
|
|
public string? Title { get; set; }
|
|
public string? Message { get; set; }
|
|
|
|
public MiniCommand YesCommand { get; }
|
|
|
|
public MiniCommand NoCommand { get; }
|
|
|
|
public MiniCommand ShowCustomManagedNotificationCommand { get; }
|
|
|
|
public MiniCommand ShowManagedNotificationCommand { get; }
|
|
}
|
|
}
|
|
|