Im trying to implement a way to set the shortcuts defined by the user.
Im using NHibernate and my model class returns me fields in Keys type (Keys is an Enum that contains the name of the keys. example: Keys.F1)
I have implemented it in a static way and the code is the following:
Expand|Select|Wrap|Line Numbers
- internal void set_shortcuts (KeyEventArgs e)
- {
- switch (e.KeyCode)
- {
- case Keys.F1: this.button_save.PerformClick(); break;
- case Keys.F2: this.button_cancel.PerformClick(); break;
- }
- }
Expand|Select|Wrap|Line Numbers
- internal void set_shortcuts (KeyEventArgs e)
- {
- Keys save_shortcut = Shortcuts.load("save_button");
- Keys cancel_shortcut = Shortcuts.load("cancel_button");
- switch (e.KeyCode)
- {
- case save_shortcut: this.button_save.PerformClick(); break;
- case cancel_shortcut: this.button_cancel.PerformClick(); break;
- }
- }
I hope you can help me
Fernando Mello