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

Profiles - Retain suspension state toggled by keybinds

This commit is contained in:
Robert 2023-03-25 22:44:34 +01:00
parent 52d53f1d23
commit 02ab5ad764

View File

@ -109,22 +109,26 @@ internal class ProfileService : IProfileService
if (profileConfiguration.HotkeyMode == ProfileConfigurationHotkeyMode.None)
return;
bool before = profileConfiguration.IsSuspended;
foreach (ArtemisKeyboardKeyEventArgs e in _pendingKeyboardEvents)
{
if (profileConfiguration.HotkeyMode == ProfileConfigurationHotkeyMode.Toggle)
{
if (profileConfiguration.EnableHotkey != null &&
profileConfiguration.EnableHotkey.MatchesEventArgs(e))
if (profileConfiguration.EnableHotkey != null && profileConfiguration.EnableHotkey.MatchesEventArgs(e))
profileConfiguration.IsSuspended = !profileConfiguration.IsSuspended;
}
else
{
if (profileConfiguration.IsSuspended && profileConfiguration.EnableHotkey != null && profileConfiguration.EnableHotkey.MatchesEventArgs(e))
profileConfiguration.IsSuspended = false;
if (!profileConfiguration.IsSuspended && profileConfiguration.DisableHotkey != null && profileConfiguration.DisableHotkey.MatchesEventArgs(e))
else if (!profileConfiguration.IsSuspended && profileConfiguration.DisableHotkey != null && profileConfiguration.DisableHotkey.MatchesEventArgs(e))
profileConfiguration.IsSuspended = true;
}
}
// If suspension was changed, save the category
if (before != profileConfiguration.IsSuspended)
SaveProfileCategory(profileConfiguration.Category);
}
private void CreateDefaultProfileCategories()
@ -422,7 +426,7 @@ internal class ProfileService : IProfileService
_profileCategories.Remove(profileCategory);
_profileCategoryRepository.Remove(profileCategory.Entity);
}
OnProfileCategoryRemoved(new ProfileCategoryEventArgs(profileCategory));
}