1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Fixed effects freezing when changing the active keyboard

This commit is contained in:
SpoinkyNL 2016-03-17 10:05:18 +01:00
parent e23a2078b7
commit c924d5120a
2 changed files with 12 additions and 19 deletions

View File

@ -120,8 +120,15 @@ namespace Artemis.Managers
private void FinishStop(object sender, RunWorkerCompletedEventArgs e) private void FinishStop(object sender, RunWorkerCompletedEventArgs e)
{ {
UpdateWorker.RunWorkerCompleted -= FinishStop;
KeyboardManager.ReleaseActiveKeyboard(); KeyboardManager.ReleaseActiveKeyboard();
Running = false; Running = false;
if (e.Error != null || !_restarting)
return;
Start();
_restarting = false;
} }
public void Pause() public void Pause()
@ -161,23 +168,9 @@ namespace Artemis.Managers
} }
_restarting = true; _restarting = true;
UpdateWorker.RunWorkerCompleted += FinishRestart;
Stop(); Stop();
} }
public void FinishRestart(object sender, RunWorkerCompletedEventArgs e)
{
UpdateWorker.RunWorkerCompleted -= FinishRestart;
if (e.Error != null)
return;
Start();
_restarting = false;
}
/// <summary> /// <summary>
/// Loads the last active effect and starts the program /// Loads the last active effect and starts the program
/// </summary> /// </summary>

View File

@ -34,13 +34,13 @@ namespace Artemis.Modules.Effects.Debug
KeyboardRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color> KeyboardRectangle = new KeyboardRectangle(MainManager.KeyboardManager.ActiveKeyboard, 0, 0, new List<Color>
{ {
Color.Red, //Color.Red,
Color.OrangeRed, //Color.OrangeRed,
Color.Yellow, //Color.Yellow,
Color.Green, Color.Green,
Color.Blue, Color.Blue,
Color.Purple, //Color.Purple,
Color.DeepPink //Color.DeepPink
}, LinearGradientMode.Horizontal); }, LinearGradientMode.Horizontal);
Initialized = true; Initialized = true;