NotificationViewModel.cs 941 B

123456789101112131415161718192021222324252627282930
  1. using System.Reactive;
  2. using Avalonia.Controls.Notifications;
  3. using MiniMvvm;
  4. namespace ControlCatalog.ViewModels
  5. {
  6. public class NotificationViewModel
  7. {
  8. public NotificationViewModel(INotificationManager manager)
  9. {
  10. YesCommand = MiniCommand.Create(() =>
  11. {
  12. manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today."));
  13. });
  14. NoCommand = MiniCommand.Create(() =>
  15. {
  16. manager.Show(new Avalonia.Controls.Notifications.Notification("Avalonia Notifications", "Start adding notifications to your app today. To find out more visit..."));
  17. });
  18. }
  19. public string? Title { get; set; }
  20. public string? Message { get; set; }
  21. public MiniCommand YesCommand { get; }
  22. public MiniCommand NoCommand { get; }
  23. }
  24. }