set taskbar state to error upon failing

This commit is contained in:
bluepilledgreat 2024-10-17 15:16:40 +01:00
parent 8babc09af8
commit a52a9b4ee8
2 changed files with 15 additions and 4 deletions

View File

@ -1,6 +1,7 @@
using System.Reflection;
using System.Security.Cryptography;
using System.Windows;
using System.Windows.Shell;
using System.Windows.Threading;
using Microsoft.Win32;
@ -35,6 +36,8 @@ namespace Bloxstrap
public static string Version = Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2];
public static Bootstrapper? Bootstrapper { get; set; } = null!;
public static bool IsActionBuild => !String.IsNullOrEmpty(BuildMetadata.CommitRef);
public static bool IsProductionBuild => IsActionBuild && BuildMetadata.CommitRef.StartsWith("tag", StringComparison.Ordinal);
@ -104,6 +107,14 @@ namespace Bloxstrap
_showingExceptionDialog = true;
if (Bootstrapper?.Dialog != null)
{
if (Bootstrapper.Dialog.TaskbarProgressValue == 0)
Bootstrapper.Dialog.TaskbarProgressValue = 1; // make sure it's visible
Bootstrapper.Dialog.TaskbarProgressState = TaskbarItemProgressState.Error;
}
Frontend.ShowExceptionDialog(ex);
Terminate(ErrorCode.ERROR_INSTALL_FAILURE);

View File

@ -202,18 +202,18 @@ namespace Bloxstrap
// start bootstrapper and show the bootstrapper modal if we're not running silently
App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper");
var bootstrapper = new Bootstrapper(launchMode);
App.Bootstrapper = new Bootstrapper(launchMode);
IBootstrapperDialog? dialog = null;
if (!App.LaunchSettings.QuietFlag.Active)
{
App.Logger.WriteLine(LOG_IDENT, "Initializing bootstrapper dialog");
dialog = App.Settings.Prop.BootstrapperStyle.GetNew();
bootstrapper.Dialog = dialog;
dialog.Bootstrapper = bootstrapper;
App.Bootstrapper.Dialog = dialog;
dialog.Bootstrapper = App.Bootstrapper;
}
Task.Run(bootstrapper.Run).ContinueWith(t =>
Task.Run(App.Bootstrapper.Run).ContinueWith(t =>
{
App.Logger.WriteLine(LOG_IDENT, "Bootstrapper task has finished");