mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 18:11:27 -07:00
Fully cleanup Bloxstrap folder after install
this also goes to show just how much of a mess bootstrapper dialog management is lol
This commit is contained in:
parent
57e6454fd7
commit
244c3dee40
@ -688,7 +688,27 @@ namespace Bloxstrap
|
|||||||
App.Logger.WriteLine($"Could not fully uninstall! ({ex})");
|
App.Logger.WriteLine($"Could not fully uninstall! ({ex})");
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog?.ShowSuccess($"{App.ProjectName} has succesfully uninstalled");
|
Action? callback = null;
|
||||||
|
|
||||||
|
if (Directory.Exists(Directories.Base))
|
||||||
|
{
|
||||||
|
callback = () =>
|
||||||
|
{
|
||||||
|
// this is definitely one of the workaround hacks of all time
|
||||||
|
// could antiviruses falsely detect this as malicious behaviour though?
|
||||||
|
// "hmm whats this program doing running a cmd command chain quietly in the background that auto deletes an entire folder"
|
||||||
|
|
||||||
|
Process.Start(new ProcessStartInfo()
|
||||||
|
{
|
||||||
|
FileName = "cmd.exe",
|
||||||
|
Arguments = $"/c timeout 5 && del /Q \"{Directories.Base}\\*\" && rmdir \"{Directories.Base}\"",
|
||||||
|
UseShellExecute = true,
|
||||||
|
WindowStyle = ProcessWindowStyle.Hidden
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
Dialog?.ShowSuccess($"{App.ProjectName} has succesfully uninstalled", callback);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Windows.Forms;
|
using System;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace Bloxstrap.UI.BootstrapperDialogs
|
namespace Bloxstrap.UI.BootstrapperDialogs
|
||||||
{
|
{
|
||||||
@ -13,7 +14,7 @@ namespace Bloxstrap.UI.BootstrapperDialogs
|
|||||||
|
|
||||||
void ShowBootstrapper();
|
void ShowBootstrapper();
|
||||||
void CloseBootstrapper();
|
void CloseBootstrapper();
|
||||||
void ShowSuccess(string message);
|
void ShowSuccess(string message, Action? callback = null);
|
||||||
void ShowError(string message);
|
void ShowError(string message);
|
||||||
void PromptShutdown();
|
void PromptShutdown();
|
||||||
}
|
}
|
||||||
|
@ -91,9 +91,13 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WPF.Views
|
|||||||
|
|
||||||
public void CloseBootstrapper() => Dispatcher.BeginInvoke(this.Close);
|
public void CloseBootstrapper() => Dispatcher.BeginInvoke(this.Close);
|
||||||
|
|
||||||
public void ShowSuccess(string message)
|
public void ShowSuccess(string message, Action? callback)
|
||||||
{
|
{
|
||||||
App.ShowMessageBox(message, MessageBoxImage.Information);
|
App.ShowMessageBox(message, MessageBoxImage.Information);
|
||||||
|
|
||||||
|
if (callback is not null)
|
||||||
|
callback();
|
||||||
|
|
||||||
App.Terminate();
|
App.Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,9 +85,13 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WPF.Views
|
|||||||
|
|
||||||
// TODO: make prompts use dialog view natively rather than using message dialog boxes
|
// TODO: make prompts use dialog view natively rather than using message dialog boxes
|
||||||
|
|
||||||
public void ShowSuccess(string message)
|
public void ShowSuccess(string message, Action? callback)
|
||||||
{
|
{
|
||||||
App.ShowMessageBox(message, MessageBoxImage.Information);
|
App.ShowMessageBox(message, MessageBoxImage.Information);
|
||||||
|
|
||||||
|
if (callback is not null)
|
||||||
|
callback();
|
||||||
|
|
||||||
App.Terminate();
|
App.Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +99,13 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
|
|||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ShowSuccess(string message)
|
public virtual void ShowSuccess(string message, Action? callback)
|
||||||
{
|
{
|
||||||
App.ShowMessageBox(message, MessageBoxImage.Information);
|
App.ShowMessageBox(message, MessageBoxImage.Information);
|
||||||
|
|
||||||
|
if (callback is not null)
|
||||||
|
callback();
|
||||||
|
|
||||||
App.Terminate();
|
App.Terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,11 +80,11 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
|
|||||||
SetupDialog();
|
SetupDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ShowSuccess(string message)
|
public override void ShowSuccess(string message, Action? callback)
|
||||||
{
|
{
|
||||||
if (this.InvokeRequired)
|
if (this.InvokeRequired)
|
||||||
{
|
{
|
||||||
this.Invoke(ShowSuccess, message);
|
this.Invoke(ShowSuccess, message, callback);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -96,7 +96,13 @@ namespace Bloxstrap.UI.BootstrapperDialogs.WinForms
|
|||||||
Buttons = { TaskDialogButton.OK }
|
Buttons = { TaskDialogButton.OK }
|
||||||
};
|
};
|
||||||
|
|
||||||
successDialog.Buttons[0].Click += (_, _) => App.Terminate();
|
successDialog.Buttons[0].Click += (_, _) =>
|
||||||
|
{
|
||||||
|
if (callback is not null)
|
||||||
|
callback();
|
||||||
|
|
||||||
|
App.Terminate();
|
||||||
|
};
|
||||||
|
|
||||||
_dialogPage.Navigate(successDialog);
|
_dialogPage.Navigate(successDialog);
|
||||||
_dialogPage = successDialog;
|
_dialogPage = successDialog;
|
||||||
|
Loading…
Reference in New Issue
Block a user