当前位置: 首页>>代码示例>>C#>>正文


C# KeyInput类代码示例

本文整理汇总了C#中KeyInput的典型用法代码示例。如果您正苦于以下问题:C# KeyInput类的具体用法?C# KeyInput怎么用?C# KeyInput使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


KeyInput类属于命名空间,在下文中一共展示了KeyInput类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CompareTo1

 public void CompareTo1()
 {
     var i1 = new KeyInput('c', KeyModifiers.None);
     Assert.IsTrue(i1.CompareTo(new KeyInput('z', KeyModifiers.None)) < 0);
     Assert.IsTrue(i1.CompareTo(new KeyInput('c', KeyModifiers.None)) == 0);
     Assert.IsTrue(i1.CompareTo(new KeyInput('a', KeyModifiers.None)) > 0);
 }
开发者ID:ameent,项目名称:VsVim,代码行数:7,代码来源:KeyInputTest.cs

示例2: GetOneKeyShortcuts

		public IEnumerable<ProviderAndCommand> GetOneKeyShortcuts(KeyInput keyInput) {
			var keyShortcut = new KeyShortcut(keyInput, KeyInput.Default);
			List<ProviderAndCommand> list;
			if (dict.TryGetValue(keyShortcut, out list))
				return list;
			return Array.Empty<ProviderAndCommand>();
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:7,代码来源:KeyShortcutCollection.cs

示例3: FindConflictingCommands3

 public void FindConflictingCommands3()
 {
     var util = Create("::ctrl+z, h");
     var inputs = new KeyInput[] { InputUtil.CharAndModifiersToKeyInput('z', KeyModifiers.Control) };
     var list = util.FindConflictingCommandKeyBindings(new HashSet<KeyInput>(inputs));
     Assert.AreEqual(1, list.Count);
 }
开发者ID:ChrisMarinos,项目名称:VsVim,代码行数:7,代码来源:KeyBindingUtilTest.cs

示例4: VimKeyData

 internal VimKeyData(KeyInput keyInput, string text)
 {
     Contract.Assert(keyInput != null);
     KeyInputOptional = keyInput;
     TextOptional = text;
     IsDeadKey = false;
 }
开发者ID:kcprogrammer,项目名称:VsVim,代码行数:7,代码来源:VimKeyData.cs

示例5: Run

        public void Run(KeyInput keyInput)
        {
            Key key;
            ModifierKeys modifierKeys;

            if (!TryConvert(keyInput, out key, out modifierKeys))
            {
                throw new Exception(String.Format("Couldn't convert {0} to Wpf keys", keyInput));
            }

            try
            {
                _defaultKeyboardDevice.DownKeyModifiers = modifierKeys;

                if (PreProcess(keyInput, key, modifierKeys))
                {
                    return;
                }

                var text = keyInput.RawChar.IsSome()
                    ? keyInput.Char.ToString()
                    : String.Empty;
                Run(text, key, modifierKeys);
            }
            finally
            {
                _defaultKeyboardDevice.DownKeyModifiers = ModifierKeys.None;

            }
        }
开发者ID:IvaN9900,项目名称:VsVim,代码行数:30,代码来源:KeyProcessorSimulation.cs

示例6: TryConvert

        internal bool TryConvert(Guid commandGroup, uint commandId, IntPtr pvaIn, out KeyInput kiOutput)
        {
            kiOutput = null;

            // Don't ever process a command when we are in an automation function.  Doing so will cause VsVim to
            // intercept items like running Macros and certain wizard functionality
            if (VsShellUtilities.IsInAutomationFunction(_serviceProvider))
            {
                return false;
            }

            EditCommand command;
            if (!OleCommandUtil.TryConvert(commandGroup, commandId, pvaIn, out command))
            {
                return false;
            }

            // If the current state of the buffer cannot process the command then do not convert it
            if (!_buffer.CanProcess(command.KeyInput))
            {
                return false;
            }

            kiOutput = command.KeyInput;
            return true;
        }
开发者ID:ChrisMarinos,项目名称:VsVim,代码行数:26,代码来源:VsCommandFilter.cs

示例7: TryConvert

        internal static bool TryConvert(Guid commandGroup, uint commandId, IntPtr variantIn, out KeyInput keyInput, out EditCommandKind kind, out bool isRawText)
        {
            if (VSConstants.GUID_VSStandardCommandSet97 == commandGroup)
            {
                return TryConvert((VSConstants.VSStd97CmdID)commandId, variantIn, out keyInput, out kind, out isRawText);
            }

            if (VSConstants.VSStd2K == commandGroup)
            {
                return TryConvert((VSConstants.VSStd2KCmdID)commandId, variantIn, out keyInput, out kind, out isRawText);
            }

            if (commandGroup == HiddenCommand.Group && commandId == HiddenCommand.Id)
            {
                keyInput = KeyInputUtil.CharWithControlToKeyInput(';');
                kind = EditCommandKind.UserInput;
                isRawText = true;
                return true;
            }

            keyInput = null;
            kind = EditCommandKind.UserInput;
            isRawText = false;
            return false;
        }
开发者ID:aesire,项目名称:VsVim,代码行数:25,代码来源:OleCommandUtil.cs

示例8: FindConflictingCommands5

 public void FindConflictingCommands5()
 {
     var util = Create("::a", "::ctrl+z, h");
     var inputs = new KeyInput[] { KeyInputUtil.CharWithControlToKeyInput('z') };
     var list = util.FindConflictingCommandKeyBindings(new HashSet<KeyInput>(inputs));
     Assert.AreEqual(1, list.Count);
 }
开发者ID:rschatz,项目名称:VsVim,代码行数:7,代码来源:KeyBindingUtilTest.cs

示例9: FindConflictingCommands4

 public void FindConflictingCommands4()
 {
     Create("::h, z");
     var inputs = new KeyInput[] { KeyInputUtil.CharToKeyInput('z') };
     var list = _serviceRaw.FindConflictingCommandKeyBindings(_commandsSnapshot, new HashSet<KeyInput>(inputs));
     Assert.Equal(0, list.Count);
 }
开发者ID:fpicalausa,项目名称:VsVim,代码行数:7,代码来源:KeyBindingServiceTest.cs

示例10: HandleKeyPress

		public override bool HandleKeyPress(KeyInput e)
		{
			if (world == null)
				return false;

			return ProcessInput(e);
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:7,代码来源:WorldCommandWidget.cs

示例11: TryGetKeyInput

        /// <summary>
        /// Try and get the KeyInput which corresponds to the given Key and modifiers
        /// TODO: really think about this method
        /// </summary>
        internal bool TryGetKeyInput(Key key, ModifierKeys modifierKeys, out KeyInput keyInput)
        {
            // First just check and see if there is a direct mapping
            var keyType = new KeyType(key, modifierKeys);
            if (_cache.TryGetValue(keyType, out keyInput))
            {
                return true;
            }

            // Next consider only the shift key part of the requested modifier.  We can
            // re-apply the original modifiers later
            keyType = new KeyType(key, modifierKeys & ModifierKeys.Shift);
            if (_cache.TryGetValue(keyType, out keyInput))
            {
                // Reapply the modifiers
                keyInput = KeyInputUtil.ChangeKeyModifiers(keyInput, ConvertToKeyModifiers(modifierKeys));
                return true;
            }

            // Last consider it without any modifiers and reapply
            keyType = new KeyType(key, ModifierKeys.None);
            if (_cache.TryGetValue(keyType, out keyInput))
            {
                // Reapply the modifiers
                keyInput = KeyInputUtil.ChangeKeyModifiers(keyInput, ConvertToKeyModifiers(modifierKeys));
                return true;
            }

            return false;
        }
开发者ID:praveennet,项目名称:VsVim,代码行数:34,代码来源:KeyboardMap.cs

示例12: FindConflictingCommands1

 public void FindConflictingCommands1()
 {
     Create("::ctrl+h");
     var inputs = new KeyInput[] { KeyInputUtil.CharWithControlToKeyInput('h') };
     var list = _serviceRaw.FindConflictingCommandKeyBindings(_commandsSnapshot, new HashSet<KeyInput>(inputs));
     Assert.Equal(1, list.Count);
 }
开发者ID:fpicalausa,项目名称:VsVim,代码行数:7,代码来源:KeyBindingServiceTest.cs

示例13: TryGetSingleMapping

        /// <summary>
        /// Try and map a KeyInput to a single KeyInput value.  This will only succeed for KeyInput 
        /// values which have no mapping or map to a single KeyInput value
        /// </summary>
        private bool TryGetSingleMapping(KeyInput original, out KeyInput mapped)
        {
            var result = _vimBuffer.GetKeyInputMapping(original);
            if (result.IsNeedsMoreInput || result.IsRecursive || result.IsPartiallyMapped)
            {
                // No single mapping
                mapped = null;
                return false;
            }

            if (result.IsMapped)
            {
                var set = ((KeyMappingResult.Mapped)result).Item;
                if (!set.IsOneKeyInput)
                {
                    mapped = null;
                    return false;
                }

                mapped = set.FirstKeyInput.Value;
                return true;
            }

            // Shouldn't get here because all cases of KeyMappingResult should be
            // handled above
            Contract.Assert(false);
            mapped = null;
            return false;
        }
开发者ID:aesire,项目名称:VsVim,代码行数:33,代码来源:StandardCommandTarget.cs

示例14: IsDisplayWindowKey

        /// <summary>
        /// Is this KeyInput intended to be processed by the active display window
        /// </summary>
        private bool IsDisplayWindowKey(KeyInput keyInput)
        {
            // Consider normal completion
            if (_broker.IsCompletionActive)
            {
                return
                    keyInput.IsArrowKey ||
                    keyInput == KeyInputUtil.EnterKey ||
                    keyInput == KeyInputUtil.TabKey ||
                    keyInput.Key == VimKey.Back;
            }

            if (_broker.IsSmartTagSessionActive)
            {
                return
                    keyInput.IsArrowKey ||
                    keyInput == KeyInputUtil.EnterKey;
            }

            if (_broker.IsSignatureHelpActive)
            {
                return keyInput.IsArrowKey;
            }

            return false;
        }
开发者ID:aesire,项目名称:VsVim,代码行数:29,代码来源:StandardCommandTarget.cs

示例15: FindConflictingCommands4

 public void FindConflictingCommands4()
 {
     var util = Create("::h, z");
     var inputs = new KeyInput[] { new KeyInput('z') };
     var list = util.FindConflictingCommandKeyBindings(new HashSet<KeyInput>(inputs));
     Assert.AreEqual(0, list.Count);
 }
开发者ID:ChrisMarinos,项目名称:VsVim,代码行数:7,代码来源:KeyBindingUtilTest.cs


注:本文中的KeyInput类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。