mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #184 from Noggog/compilerVM-status-tracker
Compiler vm status tracker
This commit is contained in:
commit
7dfe295191
@ -70,9 +70,6 @@
|
|||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="ReactiveUI">
|
|
||||||
<HintPath>..\..\..\Users\tbald\.nuget\packages\reactiveui\10.5.7\lib\net461\ReactiveUI.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
|
@ -29,6 +29,9 @@ namespace Wabbajack
|
|||||||
private readonly ObservableAsPropertyHelper<ModlistSettingsEditorVM> _CurrentModlistSettings;
|
private readonly ObservableAsPropertyHelper<ModlistSettingsEditorVM> _CurrentModlistSettings;
|
||||||
public ModlistSettingsEditorVM CurrentModlistSettings => _CurrentModlistSettings.Value;
|
public ModlistSettingsEditorVM CurrentModlistSettings => _CurrentModlistSettings.Value;
|
||||||
|
|
||||||
|
private readonly ObservableAsPropertyHelper<StatusUpdateTracker> _CurrentStatusTracker;
|
||||||
|
public StatusUpdateTracker CurrentStatusTracker => _CurrentStatusTracker.Value;
|
||||||
|
|
||||||
public CompilerVM(MainWindowVM mainWindowVM)
|
public CompilerVM(MainWindowVM mainWindowVM)
|
||||||
{
|
{
|
||||||
this.MWVM = mainWindowVM;
|
this.MWVM = mainWindowVM;
|
||||||
@ -68,10 +71,14 @@ namespace Wabbajack
|
|||||||
.Select(p => p.Current)
|
.Select(p => p.Current)
|
||||||
.ToProperty(this, nameof(this.Compiler));
|
.ToProperty(this, nameof(this.Compiler));
|
||||||
|
|
||||||
// Let sub VM determine what settings we're displaying and when
|
// Let sub VM determine what settings we're displaying and when
|
||||||
this._CurrentModlistSettings = this.WhenAny(x => x.Compiler.ModlistSettings)
|
this._CurrentModlistSettings = this.WhenAny(x => x.Compiler.ModlistSettings)
|
||||||
.ToProperty(this, nameof(this.CurrentModlistSettings));
|
.ToProperty(this, nameof(this.CurrentModlistSettings));
|
||||||
|
|
||||||
|
// Let sub VM determine what progress we're seeing
|
||||||
|
this._CurrentStatusTracker = this.WhenAny(x => x.Compiler.StatusTracker)
|
||||||
|
.ToProperty(this, nameof(this.CurrentStatusTracker));
|
||||||
|
|
||||||
this._Image = this.WhenAny(x => x.CurrentModlistSettings.ImagePath.TargetPath)
|
this._Image = this.WhenAny(x => x.CurrentModlistSettings.ImagePath.TargetPath)
|
||||||
// Throttle so that it only loads image after any sets of swaps have completed
|
// Throttle so that it only loads image after any sets of swaps have completed
|
||||||
.Throttle(TimeSpan.FromMilliseconds(50), RxApp.MainThreadScheduler)
|
.Throttle(TimeSpan.FromMilliseconds(50), RxApp.MainThreadScheduler)
|
||||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using Wabbajack.Common;
|
||||||
|
|
||||||
namespace Wabbajack
|
namespace Wabbajack
|
||||||
{
|
{
|
||||||
@ -13,6 +14,7 @@ namespace Wabbajack
|
|||||||
IReactiveCommand BeginCommand { get; }
|
IReactiveCommand BeginCommand { get; }
|
||||||
bool Compiling { get; }
|
bool Compiling { get; }
|
||||||
ModlistSettingsEditorVM ModlistSettings { get; }
|
ModlistSettingsEditorVM ModlistSettings { get; }
|
||||||
|
StatusUpdateTracker StatusTracker { get;}
|
||||||
void Unload();
|
void Unload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,9 @@ namespace Wabbajack
|
|||||||
private readonly ObservableAsPropertyHelper<ModlistSettingsEditorVM> _ModlistSettings;
|
private readonly ObservableAsPropertyHelper<ModlistSettingsEditorVM> _ModlistSettings;
|
||||||
public ModlistSettingsEditorVM ModlistSettings => _ModlistSettings.Value;
|
public ModlistSettingsEditorVM ModlistSettings => _ModlistSettings.Value;
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public StatusUpdateTracker StatusTracker { get; private set; }
|
||||||
|
|
||||||
public MO2CompilerVM(CompilerVM parent)
|
public MO2CompilerVM(CompilerVM parent)
|
||||||
{
|
{
|
||||||
this.ModlistLocation = new FilePickerVM()
|
this.ModlistLocation = new FilePickerVM()
|
||||||
@ -110,13 +113,6 @@ namespace Wabbajack
|
|||||||
ModListWebsite = this.ModlistSettings.Website,
|
ModListWebsite = this.ModlistSettings.Website,
|
||||||
ModListReadme = this.ModlistSettings.ReadMeText.TargetPath,
|
ModListReadme = this.ModlistSettings.ReadMeText.TargetPath,
|
||||||
};
|
};
|
||||||
var update_tracker = compiler.UpdateTracker;
|
|
||||||
update_tracker.Progress
|
|
||||||
.CombineLatest(update_tracker.StepName, update_tracker.MaxStep, update_tracker.Step,
|
|
||||||
(progress, name, max, step) => new {progress, name, max, step})
|
|
||||||
.Debounce(new TimeSpan(0, 0, 0, 0, 100))
|
|
||||||
.Subscribe(a =>
|
|
||||||
Utils.Log($"{a.progress} - ({a.step}/{a.max}) {a.name}"));
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -128,6 +124,7 @@ namespace Wabbajack
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
this.StatusTracker = compiler.UpdateTracker;
|
||||||
compiler.Compile();
|
compiler.Compile();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -135,6 +132,10 @@ namespace Wabbajack
|
|||||||
while (ex.InnerException != null) ex = ex.InnerException;
|
while (ex.InnerException != null) ex = ex.InnerException;
|
||||||
Utils.Log($"Compiler error: {ex.ExceptionToString()}");
|
Utils.Log($"Compiler error: {ex.ExceptionToString()}");
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
this.StatusTracker = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this._Compiling = this.BeginCommand.IsExecuting
|
this._Compiling = this.BeginCommand.IsExecuting
|
||||||
|
@ -49,6 +49,9 @@ namespace Wabbajack
|
|||||||
|
|
||||||
public ICommand FindGameInGogCommand { get; }
|
public ICommand FindGameInGogCommand { get; }
|
||||||
|
|
||||||
|
[Reactive]
|
||||||
|
public StatusUpdateTracker StatusTracker { get; private set; }
|
||||||
|
|
||||||
public VortexCompilerVM(CompilerVM parent)
|
public VortexCompilerVM(CompilerVM parent)
|
||||||
{
|
{
|
||||||
this.GameLocation = new FilePickerVM()
|
this.GameLocation = new FilePickerVM()
|
||||||
@ -100,6 +103,7 @@ namespace Wabbajack
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
this.StatusTracker = compiler.UpdateTracker;
|
||||||
compiler.Compile();
|
compiler.Compile();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -107,6 +111,10 @@ namespace Wabbajack
|
|||||||
while (ex.InnerException != null) ex = ex.InnerException;
|
while (ex.InnerException != null) ex = ex.InnerException;
|
||||||
Utils.Log($"Compiler error: {ex.ExceptionToString()}");
|
Utils.Log($"Compiler error: {ex.ExceptionToString()}");
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
this.StatusTracker = null;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
this._Compiling = this.BeginCommand.IsExecuting
|
this._Compiling = this.BeginCommand.IsExecuting
|
||||||
|
Loading…
Reference in New Issue
Block a user