I want to allow users to re-assign hotkeys at runtime and am using the Gma.System.MouseKeyHook NuGet package.
Creating new hotkeys at runtime works just fine and dandy but clearing the Action of an already assigned Combination/Sequence (by setting its Action = null) does not remove the original assignment.
Is there some way to do this on a per Combination/Sequence basis? More specifically I want to avoid calling Dispose() on my Hook.GlobalEvents() reference and having to re-initialize the whole systems assignments.
Any help would be greatly appreciated :)
If you want to unsubscribe from keypress event:
Edit:
I understand now that you called OnCombination. After going over the code of this method, you cannot change the combinations list after you created it. Other calls to OnCombination will just add more registrations.
Edit:
Another option is to use reactive extensions:
Nuget packages:
MouseKeyHook.Rx is still in pre-release version.