Пример #1
0
        protected virtual bool OnValidateShortcut(Keys shortcut)
        {
            bool result = true;

            EventHandler <KeyboardShortcutValidationEventArgs> handler = ValidateShortcut;

            if (handler != null)
            {
                foreach (Delegate currentHandler in handler.GetInvocationList())
                {
                    KeyboardShortcutValidationEventArgs args = new KeyboardShortcutValidationEventArgs(shortcut);
                    currentHandler.DynamicInvoke(this, args);

                    result &= args.IsValid;
                    if (!result)
                    {
                        break;
                    }
                }
            }

            return(result);
        }
        protected virtual bool OnValidateShortcut(Keys shortcut)
        {
            bool result = true;

            EventHandler<KeyboardShortcutValidationEventArgs> handler = ValidateShortcut;
            if (handler != null)
            {
                foreach (Delegate currentHandler in handler.GetInvocationList())
                {
                    KeyboardShortcutValidationEventArgs args = new KeyboardShortcutValidationEventArgs(shortcut);
                    currentHandler.DynamicInvoke(this, args);

                    result &= args.IsValid;
                    if (!result)
                    {
                        break;
                    }
                }
            }

            return result;
        }
 private void kbdSecondaryShortcut_ValidateShortcut(object sender, KeyboardShortcutValidationEventArgs e)
 {
     e.IsValid = IsKeyboardShortcutValid(e.Keys);
 }
 private void kbdSecondaryShortcut_ValidateShortcut(object sender, KeyboardShortcutValidationEventArgs e)
 {
     e.IsValid = IsKeyboardShortcutValid(e.Keys);
 }