ApplicationViewModel.cs 680 B

1234567891011121314151617181920212223242526
  1. using Avalonia;
  2. using Avalonia.Controls.ApplicationLifetimes;
  3. using MiniMvvm;
  4. namespace ControlCatalog.ViewModels
  5. {
  6. public class ApplicationViewModel : ViewModelBase
  7. {
  8. public ApplicationViewModel()
  9. {
  10. ExitCommand = MiniCommand.Create(() =>
  11. {
  12. if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime)
  13. {
  14. lifetime.Shutdown();
  15. }
  16. });
  17. RestoreDefault = MiniCommand.Create(() => { });
  18. }
  19. public MiniCommand ExitCommand { get; }
  20. public MiniCommand RestoreDefault { get; }
  21. }
  22. }