mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
UI - Don't kill/restart on shutdown when a debugger is attached
Modules - Attempt to fix #478
This commit is contained in:
parent
143dea4c4c
commit
925bedc0a6
@ -101,11 +101,14 @@ namespace Artemis.Core.Services
|
||||
List<Task> tasks = new List<Task>();
|
||||
foreach (Module module in modules)
|
||||
{
|
||||
bool shouldBeActivated = module.EvaluateActivationRequirements();
|
||||
if (shouldBeActivated && !module.IsActivated)
|
||||
tasks.Add(ActivateModule(module));
|
||||
else if (!shouldBeActivated && module.IsActivated)
|
||||
tasks.Add(DeactivateModule(module));
|
||||
lock (module)
|
||||
{
|
||||
bool shouldBeActivated = module.EvaluateActivationRequirements() && module.Enabled;
|
||||
if (shouldBeActivated && !module.IsActivated)
|
||||
tasks.Add(ActivateModule(module));
|
||||
else if (!shouldBeActivated && module.IsActivated)
|
||||
tasks.Add(DeactivateModule(module));
|
||||
}
|
||||
}
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
|
||||
@ -16,8 +16,8 @@ namespace Artemis.Core
|
||||
/// gracefully shut down
|
||||
/// </para>
|
||||
/// </summary>
|
||||
/// <param name="delay">The delay in seconds after which to kill the application</param>
|
||||
/// <param name="restart">Whether or not to restart the application after shutdown</param>
|
||||
/// <param name="delay">The delay in seconds after which to kill the application (ignored when a debugger is attached)</param>
|
||||
/// <param name="restart">Whether or not to restart the application after shutdown (ignored when a debugger is attached)</param>
|
||||
public static void Shutdown(int delay, bool restart)
|
||||
{
|
||||
// Always kill the process after the delay has passed, with all the plugins a graceful shutdown cannot be guaranteed
|
||||
@ -33,7 +33,9 @@ namespace Artemis.Core
|
||||
CreateNoWindow = true,
|
||||
FileName = "PowerShell.exe"
|
||||
};
|
||||
Process.Start(info);
|
||||
|
||||
if (!Debugger.IsAttached)
|
||||
Process.Start(info);
|
||||
|
||||
// Also attempt a graceful shutdown on the UI thread
|
||||
Execute.OnUIThread(() => Application.Current.Shutdown());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user