From da75aca5ca5ee3b3b349ee05dd09420c6808037e Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Sun, 24 Nov 2019 17:42:28 -0600 Subject: [PATCH] Compiler/Installer back buttons --- Wabbajack/Themes/Styles.xaml | 7 ++++++- Wabbajack/View Models/Compilers/CompilerVM.cs | 7 +++++++ Wabbajack/View Models/InstallerVM.cs | 6 ++++++ Wabbajack/Views/Common/TopProgressView.xaml | 6 +++--- Wabbajack/Views/Compilers/CompilerView.xaml | 17 +++++++++++++++++ Wabbajack/Views/InstallationView.xaml | 15 +++++++++++++++ 6 files changed, 54 insertions(+), 4 deletions(-) diff --git a/Wabbajack/Themes/Styles.xaml b/Wabbajack/Themes/Styles.xaml index e5ce7573..6a96e4a8 100644 --- a/Wabbajack/Themes/Styles.xaml +++ b/Wabbajack/Themes/Styles.xaml @@ -102,7 +102,7 @@ - + @@ -1462,6 +1462,11 @@ BasedOn="{StaticResource MahApps.Metro.Styles.MetroCircleButtonStyle}" TargetType="ButtonBase"> + + + + + diff --git a/Wabbajack/View Models/Compilers/CompilerVM.cs b/Wabbajack/View Models/Compilers/CompilerVM.cs index ccc93c78..341728bc 100644 --- a/Wabbajack/View Models/Compilers/CompilerVM.cs +++ b/Wabbajack/View Models/Compilers/CompilerVM.cs @@ -40,6 +40,8 @@ namespace Wabbajack public ObservableCollectionExtended StatusList { get; } = new ObservableCollectionExtended(); public ObservableCollectionExtended Log => MWVM.Log; + public IReactiveCommand BackCommand { get; } + public CompilerVM(MainWindowVM mainWindowVM) { MWVM = mainWindowVM; @@ -107,6 +109,11 @@ namespace Wabbajack .ObserveOnGuiThread() .ToProperty(this, nameof(Compiling)); + BackCommand = ReactiveCommand.Create( + execute: () => mainWindowVM.ActivePane = mainWindowVM.ModeSelectionVM, + canExecute: this.WhenAny(x => x.Compiling) + .Select(x => !x)); + // Compile progress updates and populate ObservableCollection this.WhenAny(x => x.Compiler.ActiveCompilation) .SelectMany(c => c?.QueueStatus ?? Observable.Empty()) diff --git a/Wabbajack/View Models/InstallerVM.cs b/Wabbajack/View Models/InstallerVM.cs index a0710c89..3dfecb9e 100644 --- a/Wabbajack/View Models/InstallerVM.cs +++ b/Wabbajack/View Models/InstallerVM.cs @@ -87,6 +87,7 @@ namespace Wabbajack public IReactiveCommand ShowReportCommand { get; } public IReactiveCommand OpenReadmeCommand { get; } public IReactiveCommand VisitWebsiteCommand { get; } + public IReactiveCommand BackCommand { get; } public InstallerVM(MainWindowVM mainWindowVM) { @@ -164,6 +165,11 @@ namespace Wabbajack .ObserveOnGuiThread() .ToProperty(this, nameof(Installing)); + BackCommand = ReactiveCommand.Create( + execute: () => mainWindowVM.ActivePane = mainWindowVM.ModeSelectionVM, + canExecute: this.WhenAny(x => x.Installing) + .Select(x => !x)); + _percentCompleted = this.WhenAny(x => x.ActiveInstallation) .StartWith(default(AInstaller)) .Pairwise() diff --git a/Wabbajack/Views/Common/TopProgressView.xaml b/Wabbajack/Views/Common/TopProgressView.xaml index fc89b8b2..650594f2 100644 --- a/Wabbajack/Views/Common/TopProgressView.xaml +++ b/Wabbajack/Views/Common/TopProgressView.xaml @@ -87,9 +87,9 @@ Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" /> + --> +