From 88610cd7db5e4d565997a8be797345da0bdef508 Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Mon, 16 May 2022 17:02:40 -0600 Subject: [PATCH] Fix install failure UI elements --- .../View Models/Installers/InstallerVM.cs | 24 +++++++++++++++---- .../Installers/InstallationCompleteView.xaml | 2 +- .../Views/Installers/InstallationView.xaml.cs | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs b/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs index c6fcc54d..727dc630 100644 --- a/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs +++ b/Wabbajack.App.Wpf/View Models/Installers/InstallerVM.cs @@ -164,6 +164,11 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM UIUtils.OpenFolder(_configuration.LogLocation); }); + CloseWhenCompleteCommand = ReactiveCommand.Create(() => + { + Environment.Exit(0); + }); + GoToInstallCommand = ReactiveCommand.Create(() => { UIUtils.OpenFolder(Installer.Location.TargetPath); @@ -267,16 +272,25 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM TaskBarUpdate.Send(update.StatusText, TaskbarItemProgressState.Indeterminate, update.StepsProgress.Value); }; - await installer.Begin(CancellationToken.None); - - TaskBarUpdate.Send($"Finished install of {ModList.Name}", TaskbarItemProgressState.Normal); - - InstallState = InstallState.Success; + if (!await installer.Begin(CancellationToken.None)) + { + TaskBarUpdate.Send($"Error during install of {ModList.Name}", TaskbarItemProgressState.Error); + InstallState = InstallState.Failure; + StatusText = $"Error during install of {ModList.Name}"; + StatusProgress = Percent.Zero; + } + else + { + TaskBarUpdate.Send($"Finished install of {ModList.Name}", TaskbarItemProgressState.Normal); + InstallState = InstallState.Success; + } } catch (Exception ex) { TaskBarUpdate.Send($"Error during install of {ModList.Name}", TaskbarItemProgressState.Error); InstallState = InstallState.Failure; + StatusText = $"Error during install of {ModList.Name}"; + StatusProgress = Percent.Zero; } } diff --git a/Wabbajack.App.Wpf/Views/Installers/InstallationCompleteView.xaml b/Wabbajack.App.Wpf/Views/Installers/InstallationCompleteView.xaml index 6aac0b84..74284763 100644 --- a/Wabbajack.App.Wpf/Views/Installers/InstallationCompleteView.xaml +++ b/Wabbajack.App.Wpf/Views/Installers/InstallationCompleteView.xaml @@ -24,7 +24,7 @@ - vm.InstallState) - .Select(es => es == InstallState.Success ? Visibility.Visible : Visibility.Collapsed) + .Select(es => es is InstallState.Success or InstallState.Failure ? Visibility.Visible : Visibility.Collapsed) .BindToStrict(this, view => view.InstallComplete.Visibility) .DisposeWith(disposables);