void Validate() { isValidating = true; duplicateHotkey = manager.GetFirstDuplicate(definition.Name, hotkeyEntry.Key, definition); isValid = duplicateHotkey == null; duplicateNotice.Visible = !isValid; clearButton.Disabled = !hotkeyEntry.Key.IsValid(); if (hotkeyEntry.Key == definition.Default || (!hotkeyEntry.Key.IsValid() && !definition.Default.IsValid())) { defaultNotice.Visible = !duplicateNotice.Visible; originalNotice.Visible = false; resetButton.Disabled = true; } else { defaultNotice.Visible = false; originalNotice.Visible = !duplicateNotice.Visible; resetButton.Disabled = false; } if (isValid && !isFirstValidation) { currentHotkey = hotkeyEntry.Key; hotkeyEntry.YieldKeyboardFocus(); Save(); } else { hotkeyEntry.TakeKeyboardFocus(); } isValidating = false; }
void ResetHotkey() { hotkeyEntryWidget.Key = selectedHotkeyDefinition.Default; hotkeyEntryWidget.YieldKeyboardFocus(); }