I'm working on a project where I need to implement customizable hotkeys across the application. There are a number of different forms and user controls that need to implement different subsets of hotkeys. I would like to implement all of the handling and processing in a central MessageFilter class.
I want to have a base class that has methods for all hotkeys, and then just override the subset of needed ones in each form/control, but I can't figure out how to have all of the forms and usercontrols share a base class. This would allow me to do something like this to process the hotkeys:
public bool PreFilterMessage(ref Message m)
{
HotKeyAction action = GetActionForKey(keydata);
BaseClass instance = GetBaseClassFromFocusedFormOrControl();
switch (action)
{
case HotKeyAction.Action1: instance.Action1() break;
}
}
Am I thinking about this the wrong way?