Ejemplo n.º 1
0
        private bool ValidateNormalStateInput(KeyEventArgs e)
        {
            CreateKeys(e, out var modifier, out var key);

            if (!ValidateBasicKeyInput(key))
            {
                return(false);
            }

            //Only F-Keys are valid as single KeyGesture key
            if (modifier == ModifierKeys.None && !CheckForFunctionKey(key))
            {
                return(false);
            }

            var sequence = new KeySequence(modifier, key);

            if (!sequence.IsValid())
            {
                return(false);
            }
            _keySequences[0] = sequence;
            _isMultiState    = true;
            return(true);
        }
Ejemplo n.º 2
0
        private bool ValidateMultiStateInput(KeyEventArgs e)
        {
            CreateKeys(e, out var modifier, out var key);

            if (_keySequences[1]?.Key == key && _keySequences[1].Modifiers == modifier)
            {
                HandleRemove();
                return(true);
            }
            if (!ValidateBasicKeyInput(key))
            {
                return(false);
            }
            var sequence = new KeySequence(modifier, key);

            if (!sequence.IsValid(ValidCheckMode.SecondSequence))
            {
                return(false);
            }
            _keySequences[1] = sequence;
            return(true);
        }