2020-01-10 04:27:59 +00:00
|
|
|
|
using ReactiveUI;
|
2019-11-24 08:12:28 +00:00
|
|
|
|
using ReactiveUI.Fody.Helpers;
|
2020-01-10 04:27:59 +00:00
|
|
|
|
using System.IO;
|
2019-11-24 08:12:28 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reactive.Linq;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
using Wabbajack.Lib;
|
2020-01-07 13:03:46 +00:00
|
|
|
|
using Wabbajack.UI;
|
2019-11-24 08:12:28 +00:00
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
public class ModeSelectionVM : ViewModel
|
|
|
|
|
{
|
|
|
|
|
private MainWindowVM _mainVM;
|
2019-11-30 09:08:04 +00:00
|
|
|
|
public ICommand BrowseCommand { get; }
|
2019-11-24 08:12:28 +00:00
|
|
|
|
public ICommand InstallCommand { get; }
|
|
|
|
|
public ICommand CompileCommand { get; }
|
|
|
|
|
|
|
|
|
|
public ModeSelectionVM(MainWindowVM mainVM)
|
|
|
|
|
{
|
|
|
|
|
_mainVM = mainVM;
|
2019-11-29 05:52:33 +00:00
|
|
|
|
|
2019-11-24 08:12:28 +00:00
|
|
|
|
InstallCommand = ReactiveCommand.Create(
|
|
|
|
|
execute: () =>
|
|
|
|
|
{
|
2019-11-24 08:44:41 +00:00
|
|
|
|
var path = mainVM.Settings.Installer.LastInstalledListLocation;
|
|
|
|
|
if (string.IsNullOrWhiteSpace(path)
|
|
|
|
|
|| !File.Exists(path))
|
|
|
|
|
{
|
|
|
|
|
path = UIUtils.OpenFileDialog($"*{ExtensionManager.Extension}|*{ExtensionManager.Extension}");
|
|
|
|
|
}
|
2019-11-30 09:08:04 +00:00
|
|
|
|
_mainVM.OpenInstaller(path);
|
2019-11-24 08:12:28 +00:00
|
|
|
|
});
|
|
|
|
|
|
2020-01-05 02:50:05 +00:00
|
|
|
|
CompileCommand = ReactiveCommand.Create(() => mainVM.NavigateTo(mainVM.Compiler.Value));
|
|
|
|
|
BrowseCommand = ReactiveCommand.Create(() => mainVM.NavigateTo(mainVM.Gallery.Value));
|
2019-11-24 08:12:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|