0
0
mirror of https://github.com/sp-tarkov/patcher.git synced 2025-02-13 09:52:45 -05:00
patcher/Patcher/PatchGenerator/ViewModels/MainWindowViewModel.cs

41 lines
1.3 KiB
C#
Raw Normal View History

2021-12-22 23:15:14 -05:00
using Avalonia;
using PatchGenerator.Models;
using ReactiveUI;
using Splat;
using System.Windows.Input;
namespace PatchGenerator.ViewModels
{
public class MainWindowViewModel : ViewModelBase
{
2021-12-22 23:15:14 -05:00
public ICommand CloseCommand => ReactiveCommand.Create(() =>
{
if (Application.Current.ApplicationLifetime is Avalonia.Controls.ApplicationLifetimes.IClassicDesktopStyleApplicationLifetime desktopApp)
{
desktopApp.MainWindow.Close();
}
});
public ViewNavigator navigator { get; set; } = new ViewNavigator();
public MainWindowViewModel(GenStartupArgs genArgs = null)
2021-12-22 23:15:14 -05:00
{
Locator.CurrentMutable.RegisterConstant(navigator, typeof(ViewNavigator));
if (genArgs != null && genArgs.ReadyToRun)
{
PatchGenInfo genInfo = new PatchGenInfo();
genInfo.TargetFolderPath = genArgs.TargetFolderPath;
genInfo.SourceFolderPath = genArgs.SourceFolderPath;
genInfo.PatchName = genArgs.OutputFolderName;
genInfo.AutoZip = genArgs.AutoZip;
navigator.SelectedViewModel = new PatchGenerationViewModel(genInfo);
return;
}
navigator.SelectedViewModel = new OptionsViewModel();
2021-12-22 23:15:14 -05:00
}
}
}