diff --git a/Bloxstrap/App.xaml b/Bloxstrap/App.xaml index afdfb30..28b450e 100644 --- a/Bloxstrap/App.xaml +++ b/Bloxstrap/App.xaml @@ -2,7 +2,8 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:Bloxstrap" - xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"> + xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" + ShutdownMode="OnExplicitShutdown"> diff --git a/Bloxstrap/App.xaml.cs b/Bloxstrap/App.xaml.cs index d938d46..9620c2b 100644 --- a/Bloxstrap/App.xaml.cs +++ b/Bloxstrap/App.xaml.cs @@ -55,9 +55,9 @@ namespace Bloxstrap public static void Terminate(int code = Bootstrapper.ERROR_SUCCESS) { + Debug.WriteLine($"[App] Terminating with exit code {code}"); Settings.Save(); State.Save(); - Debug.WriteLine($"[App] Terminating with exit code {code}"); Environment.Exit(code); } @@ -109,14 +109,12 @@ namespace Bloxstrap registryKey.Close(); } - // preferences dialog was closed, and so base directory was never set + // exit if we don't click the install button on installation if (!IsSetupComplete) Environment.Exit(Bootstrapper.ERROR_INSTALL_USEREXIT); Directories.Initialize(BaseDirectory); - //Settings.FileLocation = Path.Combine(Directories.Base, "Settings.json"); - // we shouldn't save settings on the first run until the first installation is finished, // just in case the user decides to cancel the install if (!IsFirstRun) @@ -185,6 +183,7 @@ namespace Bloxstrap Task bootstrapperTask = Task.Run(() => bootstrapper.Run()).ContinueWith(t => { // TODO: add error logging + Debug.WriteLine("[App] Bootstrapper task has finished"); if (t.Exception is null) return; diff --git a/Bloxstrap/Bloxstrap.csproj b/Bloxstrap/Bloxstrap.csproj index 7a5330e..7077d10 100644 --- a/Bloxstrap/Bloxstrap.csproj +++ b/Bloxstrap/Bloxstrap.csproj @@ -13,7 +13,14 @@ + + + + + + + @@ -35,7 +42,14 @@ + + + + + + + diff --git a/Bloxstrap/Dialogs/BootstrapperDialogForm.cs b/Bloxstrap/Dialogs/BootstrapperDialogForm.cs index 62e2a50..f0bf3ae 100644 --- a/Bloxstrap/Dialogs/BootstrapperDialogForm.cs +++ b/Bloxstrap/Dialogs/BootstrapperDialogForm.cs @@ -10,8 +10,9 @@ namespace Bloxstrap.Dialogs { public class BootstrapperDialogForm : Form, IBootstrapperDialog { - public Bootstrapper Bootstrapper { get; set; } = null!; + public Bootstrapper? Bootstrapper { get; set; } + #region UI Elements protected virtual string _message { get; set; } = "Please wait..."; protected virtual ProgressBarStyle _progressStyle { get; set; } protected virtual int _progressValue { get; set; } @@ -64,6 +65,7 @@ namespace Bloxstrap.Dialogs _cancelEnabled = value; } } + #endregion public void ScaleWindow() { @@ -83,6 +85,13 @@ namespace Bloxstrap.Dialogs this.Icon = App.Settings.Prop.BootstrapperIcon.GetIcon(); } + public void ButtonCancel_Click(object? sender, EventArgs e) + { + Bootstrapper?.CancelInstall(); + this.Close(); + } + + #region IBootstrapperDialog Methods public void ShowBootstrapper() => this.ShowDialog(); public virtual void CloseBootstrapper() @@ -116,11 +125,6 @@ namespace Bloxstrap.Dialogs if (result != MessageBoxResult.OK) Environment.Exit(Bootstrapper.ERROR_INSTALL_USEREXIT); } - - public void ButtonCancel_Click(object? sender, EventArgs e) - { - Bootstrapper.CancelInstall(); - this.Close(); - } - } + #endregion + } } diff --git a/Bloxstrap/Dialogs/FluentDialog.xaml b/Bloxstrap/Dialogs/FluentDialog.xaml new file mode 100644 index 0000000..604b2e4 --- /dev/null +++ b/Bloxstrap/Dialogs/FluentDialog.xaml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + +