Edit: I have added the revised code in an answer to this question.
Currently, I handle the keyboard shortcuts of my applications in a single huge method that looks like this:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
// Next issue (validate the fix)
if (keyData == (Keys.Control | Keys.Enter) ||
keyData == (Keys.Shift | Keys.Enter))
{
mark_as_fixed();
return true;
}
// Skip to next issue without validating or changing anything
if (keyData == (Keys.Alt | Keys.Down))
{
next_issue();
}
// Previous issue
if (keyData == (Keys.Alt | Keys.Up))
{
previous_issue();
return true;
}
... [130 lines of this]
It works perfectly, it isn't particularly hard to read or maintain, but having a method 130 lines long and constantly growing just feels wrong.
Also I may want to implement shortcut customization in the future, and there is no easy way to find out what keys are mapped to which method so it will have to be rewritten.
Since all non trivial applications have a gazillion shortcuts, I assume it's a solved problem, but I couldn't find a good explanation on how applications handle their shortcuts.
[130 lines of this]
could be relevant to a fruitful peer review. Can't you include the whole method body? \$\endgroup\$