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>();
|
List<Task> tasks = new List<Task>();
|
||||||
foreach (Module module in modules)
|
foreach (Module module in modules)
|
||||||
{
|
{
|
||||||
bool shouldBeActivated = module.EvaluateActivationRequirements();
|
lock (module)
|
||||||
if (shouldBeActivated && !module.IsActivated)
|
{
|
||||||
tasks.Add(ActivateModule(module));
|
bool shouldBeActivated = module.EvaluateActivationRequirements() && module.Enabled;
|
||||||
else if (!shouldBeActivated && module.IsActivated)
|
if (shouldBeActivated && !module.IsActivated)
|
||||||
tasks.Add(DeactivateModule(module));
|
tasks.Add(ActivateModule(module));
|
||||||
|
else if (!shouldBeActivated && module.IsActivated)
|
||||||
|
tasks.Add(DeactivateModule(module));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.WhenAll(tasks);
|
await Task.WhenAll(tasks);
|
||||||
|
|||||||
@ -16,8 +16,8 @@ namespace Artemis.Core
|
|||||||
/// gracefully shut down
|
/// gracefully shut down
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="delay">The delay in seconds after which to kill the application</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</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)
|
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
|
// 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,
|
CreateNoWindow = true,
|
||||||
FileName = "PowerShell.exe"
|
FileName = "PowerShell.exe"
|
||||||
};
|
};
|
||||||
Process.Start(info);
|
|
||||||
|
if (!Debugger.IsAttached)
|
||||||
|
Process.Start(info);
|
||||||
|
|
||||||
// Also attempt a graceful shutdown on the UI thread
|
// Also attempt a graceful shutdown on the UI thread
|
||||||
Execute.OnUIThread(() => Application.Current.Shutdown());
|
Execute.OnUIThread(() => Application.Current.Shutdown());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user