Fix install failure UI elements

This commit is contained in:
Timothy Baldridge 2022-05-16 17:02:40 -06:00
parent 7b5b483303
commit 88610cd7db
3 changed files with 21 additions and 7 deletions

View File

@ -164,6 +164,11 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
UIUtils.OpenFolder(_configuration.LogLocation); UIUtils.OpenFolder(_configuration.LogLocation);
}); });
CloseWhenCompleteCommand = ReactiveCommand.Create(() =>
{
Environment.Exit(0);
});
GoToInstallCommand = ReactiveCommand.Create(() => GoToInstallCommand = ReactiveCommand.Create(() =>
{ {
UIUtils.OpenFolder(Installer.Location.TargetPath); UIUtils.OpenFolder(Installer.Location.TargetPath);
@ -267,16 +272,25 @@ public class InstallerVM : BackNavigatingVM, IBackNavigatingVM, ICpuStatusVM
TaskBarUpdate.Send(update.StatusText, TaskbarItemProgressState.Indeterminate, update.StepsProgress.Value); TaskBarUpdate.Send(update.StatusText, TaskbarItemProgressState.Indeterminate, update.StepsProgress.Value);
}; };
await installer.Begin(CancellationToken.None); if (!await installer.Begin(CancellationToken.None))
{
TaskBarUpdate.Send($"Finished install of {ModList.Name}", TaskbarItemProgressState.Normal); TaskBarUpdate.Send($"Error during install of {ModList.Name}", TaskbarItemProgressState.Error);
InstallState = InstallState.Failure;
InstallState = InstallState.Success; 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) catch (Exception ex)
{ {
TaskBarUpdate.Send($"Error during install of {ModList.Name}", TaskbarItemProgressState.Error); TaskBarUpdate.Send($"Error during install of {ModList.Name}", TaskbarItemProgressState.Error);
InstallState = InstallState.Failure; InstallState = InstallState.Failure;
StatusText = $"Error during install of {ModList.Name}";
StatusProgress = Percent.Zero;
} }
} }

View File

@ -24,7 +24,7 @@
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" <TextBlock Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="5"
x:Name="TitleText" x:Name="TitleText"
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Bottom" VerticalAlignment="Bottom"

View File

@ -31,7 +31,7 @@ namespace Wabbajack
.DisposeWith(disposables); .DisposeWith(disposables);
ViewModel.WhenAnyValue(vm => vm.InstallState) ViewModel.WhenAnyValue(vm => 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) .BindToStrict(this, view => view.InstallComplete.Visibility)
.DisposeWith(disposables); .DisposeWith(disposables);