NotificationViewModel.cs 989 B

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