コード例 #1
0
        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());
        }
コード例 #4
0
        public void TheIsEmptyMethod(Key key, ModifierKeys modifierKeys, bool expectedValue)
        {
            var inputGesture = new InputGesture(key, modifierKeys);

            Assert.AreEqual(expectedValue, inputGesture.IsEmpty());
        }
コード例 #5
0
ファイル: CommandInfo.cs プロジェクト: icygit/Orchestra
 public CommandInfo(string commandName, InputGesture inputGesture)
 {
     CommandName = commandName;
     InputGesture = inputGesture;
 }