mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
CompilerVM active intervention variable
This commit is contained in:
parent
2ec760527a
commit
02f53f4e7c
@ -41,6 +41,9 @@ namespace Wabbajack
|
||||
|
||||
public IReactiveCommand BackCommand { get; }
|
||||
|
||||
private readonly ObservableAsPropertyHelper<IUserIntervention> _ActiveGlobalUserIntervention;
|
||||
public IUserIntervention ActiveGlobalUserIntervention => _ActiveGlobalUserIntervention.Value;
|
||||
|
||||
public CompilerVM(MainWindowVM mainWindowVM)
|
||||
{
|
||||
MWVM = mainWindowVM;
|
||||
@ -137,6 +140,22 @@ namespace Wabbajack
|
||||
.Switch()
|
||||
.Debounce(TimeSpan.FromMilliseconds(25))
|
||||
.ToProperty(this, nameof(PercentCompleted));
|
||||
|
||||
// Listen for user interventions, and compile a dynamic list of all unhandled ones
|
||||
var activeInterventions = this.WhenAny(x => x.Compiler.ActiveCompilation)
|
||||
.SelectMany(c => c?.LogMessages ?? Observable.Empty<IStatusMessage>())
|
||||
.WhereCastable<IStatusMessage, IUserIntervention>()
|
||||
.ToObservableChangeSet()
|
||||
.AutoRefresh(i => i.Handled)
|
||||
.Filter(i => !i.Handled)
|
||||
.AsObservableList();
|
||||
|
||||
// Find the top intervention /w no CPU ID to be marked as "global"
|
||||
_ActiveGlobalUserIntervention = activeInterventions.Connect()
|
||||
.Filter(x => x.CpuID == WorkQueue.UnassignedCpuId)
|
||||
.QueryWhenChanged(query => query.FirstOrDefault())
|
||||
.ObserveOnGuiThread()
|
||||
.ToProperty(this, nameof(ActiveGlobalUserIntervention));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user