private void GlobalKeyUp(object sender, KeyEventArgs e) { // update form foreach (Control c in AddForm.Controls) { c.Enabled = true; } AddForm.button6.Enabled = true; AddForm.DrawKeyDisplay(); AddForm.TextBoxKeyCombo.Select(AddForm.TextBoxKeyCombo.Text.Length, 0); // remove hook HookManager.CleanHook(); }
private void GlobalKeyDown(object sender, KeyEventArgs e) { string[] parts = DefaultKeyAction.GetKeyCombo(Keys, true).Split('+'); if (parts.Where(p => p == PrettyKeys.Convert(e.KeyCode)).Any()) { return; // dont allow duplicate keys in the combo } if (parts.Length < DefaultKeyAction.KEY_COUNT) { for (int i = 0; i < Keys.Length; i++) { if (Keys[i] == System.Windows.Forms.Keys.None) { Keys[i] = e.KeyCode; break; } } } AddForm.DrawKeyDisplay(); }