private void OnNewInputGestureTextBoxKeyDown(object sender, KeyEventArgs e)
        {
            e.Handled = true;

            var vm = ViewModel as KeyboardMappingsCustomizationViewModel;
            if (vm != null)
            {
                var modifiers = KeyboardHelper.GetCurrentlyPressedModifiers();
                if (modifiers.Count == 0 && modifiers[0] == ModifierKeys.Shift)
                {
                    // Only ignore just shift, control + shift is allowed
                    return;
                }

                var key = e.Key;

                if (!_keyboardMappingsAllowedKeysService.IsAllowed(key))
                {
                    return;
                }

                var finalModifiers = ModifierKeys.None;

                foreach (var modifier in modifiers)
                {
                    finalModifiers = Enum<ModifierKeys>.Flags.SetFlag(finalModifiers, modifier);
                }

                var inputGesture = new InputGesture(key, finalModifiers);
                vm.SelectedCommandNewInputGesture = inputGesture;
            }
        }
예제 #2
0
        /// <summary>
        /// Equalses the specified other.
        /// </summary>
        /// <param name="other">The other.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        /// <exception cref="System.NotImplementedException"></exception>
        protected bool Equals(InputGesture other)
        {
            if (other == null)
            {
                return(false);
            }

            if (Key != other.Key)
            {
                return(false);
            }

            if (Modifiers != other.Modifiers)
            {
                return(false);
            }

            return(true);
        }
예제 #3
0
        public void TheIsEmptyMethod(Key key, ModifierKeys modifierKeys, bool expectedValue)
        {
            var inputGesture = new InputGesture(key, modifierKeys);

            Assert.AreEqual(expectedValue, inputGesture.IsEmpty());
        }
        public void TheIsEmptyMethod(Key key, ModifierKeys modifierKeys, bool expectedValue)
        {
            var inputGesture = new InputGesture(key, modifierKeys);

            Assert.AreEqual(expectedValue, inputGesture.IsEmpty());
        }
예제 #5
0
 public CommandInfo(string commandName, InputGesture inputGesture)
 {
     CommandName = commandName;
     InputGesture = inputGesture;
 }