2020-02-11 23:02:12 +00:00
|
|
|
|
using ReactiveUI;
|
2019-11-24 08:12:28 +00:00
|
|
|
|
using ReactiveUI.Fody.Helpers;
|
2020-02-02 07:33:12 +00:00
|
|
|
|
using System;
|
2020-01-10 04:27:59 +00:00
|
|
|
|
using System.IO;
|
2019-11-24 08:12:28 +00:00
|
|
|
|
using System.Linq;
|
2020-02-02 07:33:12 +00:00
|
|
|
|
using System.Reactive;
|
2019-11-24 08:12:28 +00:00
|
|
|
|
using System.Reactive.Linq;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
using Wabbajack.Lib;
|
|
|
|
|
|
|
|
|
|
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; }
|
2020-02-02 07:33:12 +00:00
|
|
|
|
public ReactiveCommand<Unit, Unit> UpdateCommand { get; }
|
2019-11-24 08:12:28 +00:00
|
|
|
|
|
|
|
|
|
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;
|
2020-03-28 20:04:22 +00:00
|
|
|
|
if (path == default || !path.Exists)
|
2019-11-24 08:44:41 +00:00
|
|
|
|
{
|
2020-01-20 01:49:12 +00:00
|
|
|
|
path = UIUtils.OpenFileDialog($"*{Consts.ModListExtension}|*{Consts.ModListExtension}");
|
2019-11-24 08:44:41 +00:00
|
|
|
|
}
|
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
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|