mirror of
https://github.com/sp-tarkov/patcher.git
synced 2025-02-13 07:30:45 -05:00
30 lines
921 B
C#
30 lines
921 B
C#
using Avalonia;
|
|
using ReactiveUI;
|
|
using System.Reactive.Disposables;
|
|
using System.Windows.Input;
|
|
|
|
namespace PatchClient.ViewModels
|
|
{
|
|
public class MainWindowViewModel : ReactiveObject, IActivatableViewModel, IScreen
|
|
{
|
|
public ViewModelActivator Activator { get; } = new ViewModelActivator();
|
|
public RoutingState Router { get; } = new RoutingState();
|
|
|
|
public ICommand CloseCommand => ReactiveCommand.Create(() =>
|
|
{
|
|
if (Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp)
|
|
{
|
|
desktopApp.MainWindow.Close();
|
|
}
|
|
});
|
|
|
|
public MainWindowViewModel()
|
|
{
|
|
this.WhenActivated((CompositeDisposable disposable) =>
|
|
{
|
|
Router.Navigate.Execute(new PatcherViewModel(this));
|
|
});
|
|
}
|
|
}
|
|
}
|