diff --git a/Wabbajack/View Models/Compilers/CompilerVM.cs b/Wabbajack/View Models/Compilers/CompilerVM.cs index 9f5e5764..46f2db34 100644 --- a/Wabbajack/View Models/Compilers/CompilerVM.cs +++ b/Wabbajack/View Models/Compilers/CompilerVM.cs @@ -1,4 +1,6 @@ -using Microsoft.WindowsAPICodePack.Dialogs; +using DynamicData; +using DynamicData.Binding; +using Microsoft.WindowsAPICodePack.Dialogs; using ReactiveUI; using ReactiveUI.Fody.Helpers; using System; @@ -101,6 +103,19 @@ namespace Wabbajack .Select(compilation => compilation != null) .ObserveOnGuiThread() .ToProperty(this, nameof(this.Compiling)); + + // Compile progress updates and populate ObservableCollection + var subscription = this.WhenAny(x => x.Compiler.ActiveCompilation) + .SelectMany(c => c?.QueueStatus ?? Observable.Empty()) + .ObserveOn(RxApp.TaskpoolScheduler) + .ToObservableChangeSet(x => x.ID) + .Batch(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler) + .EnsureUniqueChanges() + .ObserveOn(RxApp.MainThreadScheduler) + .Sort(SortExpressionComparer.Ascending(s => s.ID), SortOptimisations.ComparesImmutableValuesOnly) + .Bind(this.MWVM.StatusList) + .Subscribe() + .DisposeWith(this.CompositeDisposable); } } }