mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #590 from erri120/issue-588
Replaced Go to Modlist with Open Logs Folder when complation failed
This commit is contained in:
commit
1cb43f894a
@ -39,7 +39,8 @@ namespace Wabbajack.Common
|
||||
return processList.Where(process => process.ProcessName == "ModOrganizer").Any(process => Path.GetDirectoryName(process.MainModule?.FileName) == mo2Path);
|
||||
}
|
||||
|
||||
public static string LogFile { get; private set; }
|
||||
public static string LogFile { get; }
|
||||
public static string LogFolder { get; }
|
||||
|
||||
public enum FileEventType
|
||||
{
|
||||
@ -57,6 +58,7 @@ namespace Wabbajack.Common
|
||||
Directory.CreateDirectory(Consts.LogsFolder);
|
||||
|
||||
var programName = Assembly.GetEntryAssembly()?.Location ?? "Wabbajack";
|
||||
LogFolder = Path.Combine(Path.GetDirectoryName(programName), Consts.LogsFolder);
|
||||
LogFile = Path.Combine(Consts.LogsFolder, Path.GetFileNameWithoutExtension(programName) + ".current.log");
|
||||
_startTime = DateTime.Now;
|
||||
|
||||
|
@ -48,7 +48,7 @@ namespace Wabbajack
|
||||
public ObservableCollectionExtended<IStatusMessage> Log => MWVM.Log;
|
||||
|
||||
public ReactiveCommand<Unit, Unit> BackCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> GoToModlistCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> GoToCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> CloseWhenCompleteCommand { get; }
|
||||
public ReactiveCommand<Unit, Unit> BeginCommand { get; }
|
||||
|
||||
@ -226,18 +226,21 @@ namespace Wabbajack
|
||||
MWVM.ShutdownApplication();
|
||||
});
|
||||
|
||||
GoToModlistCommand = ReactiveCommand.Create(
|
||||
GoToCommand = ReactiveCommand.Create(
|
||||
canExecute: this.WhenAny(x => x.Completed)
|
||||
.Select(x => x != null),
|
||||
execute: () =>
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(OutputLocation.TargetPath))
|
||||
if (Completed?.Failed ?? false)
|
||||
{
|
||||
Process.Start("explorer.exe", Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location));
|
||||
Process.Start("explorer.exe", Utils.LogFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
Process.Start("explorer.exe", OutputLocation.TargetPath);
|
||||
Process.Start("explorer.exe",
|
||||
string.IsNullOrWhiteSpace(OutputLocation.TargetPath)
|
||||
? Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location)
|
||||
: OutputLocation.TargetPath);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -85,7 +85,7 @@
|
||||
Grid.Row="1"
|
||||
Margin="0,10,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
Text="Go To Modlist" />
|
||||
x:Name="ActionText" />
|
||||
</Grid>
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
|
@ -1,19 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Wabbajack
|
||||
@ -21,7 +7,7 @@ namespace Wabbajack
|
||||
/// <summary>
|
||||
/// Interaction logic for CompilationCompleteView.xaml
|
||||
/// </summary>
|
||||
public partial class CompilationCompleteView : ReactiveUserControl<CompilerVM>
|
||||
public partial class CompilationCompleteView
|
||||
{
|
||||
public CompilationCompleteView()
|
||||
{
|
||||
@ -34,16 +20,18 @@ namespace Wabbajack
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.Completed)
|
||||
.Select(x => x?.Failed ?? false)
|
||||
.Select(failed =>
|
||||
{
|
||||
return $"Compilation {(failed ? "Failed" : "Complete")}";
|
||||
})
|
||||
.Select(failed => $"Compilation {(failed ? "Failed" : "Complete")}")
|
||||
.BindToStrict(this, x => x.TitleText.Text)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.Completed)
|
||||
.Select(x => x?.Failed ?? false)
|
||||
.Select(failed => failed ? "Open Logs Folder" : "Go to Modlist")
|
||||
.BindToStrict(this, x => x.ActionText.Text)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.BackCommand)
|
||||
.BindToStrict(this, x => x.BackButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.GoToModlistCommand)
|
||||
this.WhenAny(x => x.ViewModel.GoToCommand)
|
||||
.BindToStrict(this, x => x.GoToModlistButton.Command)
|
||||
.DisposeWith(dispose);
|
||||
this.WhenAny(x => x.ViewModel.CloseWhenCompleteCommand)
|
||||
|
Loading…
Reference in New Issue
Block a user