2021-12-19 21:37:31 -05:00
|
|
|
using Avalonia;
|
2021-12-11 21:47:59 -05:00
|
|
|
using PatchClient.Models;
|
2021-12-19 21:37:31 -05:00
|
|
|
using ReactiveUI;
|
2021-12-11 21:47:59 -05:00
|
|
|
using Splat;
|
2021-12-19 21:37:31 -05:00
|
|
|
using System.Windows.Input;
|
2021-12-11 21:47:59 -05:00
|
|
|
|
|
|
|
namespace PatchClient.ViewModels
|
|
|
|
{
|
|
|
|
public class MainWindowViewModel : ViewModelBase
|
|
|
|
{
|
2021-12-19 21:37:31 -05:00
|
|
|
public ICommand CloseCommand => ReactiveCommand.Create(() =>
|
|
|
|
{
|
2021-12-25 01:17:01 -05:00
|
|
|
if (Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp)
|
2021-12-19 21:37:31 -05:00
|
|
|
{
|
|
|
|
desktopApp.MainWindow.Close();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2021-12-11 21:47:59 -05:00
|
|
|
public ViewNavigator navigator { get; set; } = new ViewNavigator();
|
|
|
|
public MainWindowViewModel()
|
|
|
|
{
|
|
|
|
navigator.SelectedViewModel = new PatcherViewModel();
|
|
|
|
|
|
|
|
Locator.CurrentMutable.RegisterConstant(navigator, typeof(ViewNavigator));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|