From 6c4fbc847638bdeb7b835442fb06ba42b4a10988 Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 27 Dec 2019 15:50:27 -0600 Subject: [PATCH] Improved top title bar configuration text --- Wabbajack/View Models/Compilers/CompilerVM.cs | 19 +++++++++++++++++++ .../View Models/Installers/InstallerVM.cs | 10 ++++++++-- Wabbajack/Views/Compilers/CompilerView.xaml | 2 +- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/Wabbajack/View Models/Compilers/CompilerVM.cs b/Wabbajack/View Models/Compilers/CompilerVM.cs index 1c1e6bb0..86ae7666 100644 --- a/Wabbajack/View Models/Compilers/CompilerVM.cs +++ b/Wabbajack/View Models/Compilers/CompilerVM.cs @@ -60,6 +60,9 @@ namespace Wabbajack [Reactive] public ErrorResponse? Completed { get; set; } + private readonly ObservableAsPropertyHelper _progressTitle; + public string ProgressTitle => _progressTitle.Value; + public CompilerVM(MainWindowVM mainWindowVM) { MWVM = mainWindowVM; @@ -247,6 +250,22 @@ namespace Wabbajack Process.Start("explorer.exe", OutputLocation.TargetPath); } }); + + _progressTitle = Observable.CombineLatest( + this.WhenAny(x => x.Compiling), + this.WhenAny(x => x.StartedCompilation), + resultSelector: (compiling, started) => + { + if (compiling) + { + return "Compiling"; + } + else + { + return started ? "Compiled" : "Configuring"; + } + }) + .ToProperty(this, nameof(ProgressTitle)); } } } diff --git a/Wabbajack/View Models/Installers/InstallerVM.cs b/Wabbajack/View Models/Installers/InstallerVM.cs index effa896e..dd6d37ef 100644 --- a/Wabbajack/View Models/Installers/InstallerVM.cs +++ b/Wabbajack/View Models/Installers/InstallerVM.cs @@ -281,8 +281,14 @@ namespace Wabbajack this.WhenAny(x => x.StartedInstallation), resultSelector: (installing, started) => { - if (!installing) return "Configuring"; - return started ? "Installing" : "Installed"; + if (installing) + { + return "Installing"; + } + else + { + return started ? "Installed" : "Configuring"; + } }) .ToProperty(this, nameof(ProgressTitle)); diff --git a/Wabbajack/Views/Compilers/CompilerView.xaml b/Wabbajack/Views/Compilers/CompilerView.xaml index 409b9104..7db0c6f2 100644 --- a/Wabbajack/Views/Compilers/CompilerView.xaml +++ b/Wabbajack/Views/Compilers/CompilerView.xaml @@ -77,7 +77,7 @@ Grid.ColumnSpan="5" OverhangShadow="True" ProgressPercent="{Binding PercentCompleted}" - StatePrefixTitle="Compiling" /> + StatePrefixTitle="{Binding ProgressTitle}" />