fix: bootstrapper dry run fix

This commit is contained in:
rjindael 2023-08-02 03:09:03 -07:00
parent c82a34f9a4
commit fe816fd2b6
No known key found for this signature in database
GPG Key ID: D069369C906CCF31
2 changed files with 21 additions and 16 deletions

View File

@ -31,11 +31,19 @@ public class MainWindow : Form
Buttons = { CloseButton } Buttons = { CloseButton }
}; };
Page.Created += (s, e) => Page.Created += (_, _) =>
{ {
if (Bootstrapper.Initialize())
Bootstrapper.Run(); Bootstrapper.Run();
}; };
// This is a small hack to ensure that the underlying Form that MainWindow has
// doesn't open when the TaskDialogPage is destroyed.
Page.Destroyed += (_, _) =>
{
Environment.Exit(0);
};
ShowTaskDialog(); ShowTaskDialog();
} }
@ -75,8 +83,8 @@ public class MainWindow : Form
private void Bootstrapper_Errored(object? sender, string[] texts) private void Bootstrapper_Errored(object? sender, string[] texts)
{ {
Page.Icon = TaskDialogIcon.Error;
Page.Heading = texts[0]; Page.Heading = texts[0];
Page.Text = texts[1]; Page.Text = texts[1];
Page.ProgressBar!.State = TaskDialogProgressBarState.Error;
} }
} }

View File

@ -1,7 +1,5 @@
using System.Runtime.InteropServices; namespace Kiseki.Launcher.Windows;
namespace Kiseki.Launcher.Windows
{
public static class Win32 public static class Win32
{ {
// Ref: https://learn.microsoft.com/en-us/windows/win32/msi/error-codes // Ref: https://learn.microsoft.com/en-us/windows/win32/msi/error-codes
@ -15,4 +13,3 @@ namespace Kiseki.Launcher.Windows
ERROR_INTERNAL_ERROR = 1359 ERROR_INTERNAL_ERROR = 1359
} }
} }
}