What's a good design to handle multiple global hotkeys?
- by Alex
I'm struggling to think of a good design to handle multiple global hotkeys.
Say I have three different functions bound to three different global hotkeys...
Play Song | Ctrl + P
Skip Song | Ctrl + N
Increase Volume | Ctrl + V
What's a good, effective way to check if the hotkey pressed conforms to a certain function? I'm using a class very similar to this: http://www.liensberger.it/web/blog/?p=207
Should I create a new instance of the hotkey class for each hotkey?
Hotkey hotkey = new Hotkey();
hotkey.RegisterHotkey(Shortcut.ModifierKeys.Control, Keys.F10);
hotkey.KeyPressed += ((s, args) =>
{
//Do Something!
});
Or should I have an enum with different hotkey functions and manage it from within the hotkey class to prevent multiple instances (seems wasteful but easy). Thanks for any advice / help in advance.