mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Compiler-side progress bars wired up again
This commit is contained in:
parent
fbe3b9edb7
commit
ece11e9f41
@ -38,9 +38,9 @@ namespace Wabbajack.Common
|
||||
_progress.OnNext(0.0f);
|
||||
}
|
||||
|
||||
public void MakeUpdate(double progress)
|
||||
public void MakeUpdate(float progress)
|
||||
{
|
||||
_progress.OnNext((float)0.0);
|
||||
_progress.OnNext(progress);
|
||||
}
|
||||
|
||||
public void MakeUpdate(int max, int curr)
|
||||
|
@ -34,6 +34,9 @@ namespace Wabbajack
|
||||
private readonly ObservableAsPropertyHelper<bool> _compiling;
|
||||
public bool Compiling => _compiling.Value;
|
||||
|
||||
private readonly ObservableAsPropertyHelper<float> _percentCompleted;
|
||||
public float PercentCompleted => _percentCompleted.Value;
|
||||
|
||||
public CompilerVM(MainWindowVM mainWindowVM)
|
||||
{
|
||||
MWVM = mainWindowVM;
|
||||
@ -113,6 +116,21 @@ namespace Wabbajack
|
||||
.Bind(MWVM.StatusList)
|
||||
.Subscribe()
|
||||
.DisposeWith(CompositeDisposable);
|
||||
|
||||
_percentCompleted = this.WhenAny(x => x.Compiler.ActiveCompilation)
|
||||
.StartWith(default(ACompiler))
|
||||
.Pairwise()
|
||||
.Select(c =>
|
||||
{
|
||||
if (c.Current == null)
|
||||
{
|
||||
return Observable.Return<float>(c.Previous == null ? 0f : 1f);
|
||||
}
|
||||
return c.Current.PercentCompleted;
|
||||
})
|
||||
.Switch()
|
||||
.Debounce(TimeSpan.FromMilliseconds(25))
|
||||
.ToProperty(this, nameof(PercentCompleted));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="5"
|
||||
OverhangShadow="True"
|
||||
ProgressPercent="{Binding ProgressPercent}"
|
||||
ProgressPercent="{Binding PercentCompleted}"
|
||||
StatePrefixTitle="Compiling" />
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
|
Loading…
Reference in New Issue
Block a user