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,9 +31,17 @@ public class MainWindow : Form
Buttons = { CloseButton }
};
Page.Created += (s, e) =>
Page.Created += (_, _) =>
{
Bootstrapper.Run();
if (Bootstrapper.Initialize())
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();
@ -75,8 +83,8 @@ public class MainWindow : Form
private void Bootstrapper_Errored(object? sender, string[] texts)
{
Page.Icon = TaskDialogIcon.Error;
Page.Heading = texts[0];
Page.Text = texts[1];
Page.ProgressBar!.State = TaskDialogProgressBarState.Error;
}
}

View File

@ -1,18 +1,15 @@
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://i-logic.com/serial/errorcodes.htm
public enum ErrorCode
{
// Ref: https://learn.microsoft.com/en-us/windows/win32/msi/error-codes
// Ref: https://i-logic.com/serial/errorcodes.htm
public enum ErrorCode
{
ERROR_SUCCESS = 0,
ERROR_INSTALL_USEREXIT = 1602,
ERROR_INSTALL_FAILURE = 1603,
ERROR_CANCELLED = 1223,
ERROR_INTERNAL_ERROR = 1359
}
ERROR_SUCCESS = 0,
ERROR_INSTALL_USEREXIT = 1602,
ERROR_INSTALL_FAILURE = 1603,
ERROR_CANCELLED = 1223,
ERROR_INTERNAL_ERROR = 1359
}
}