• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# KeyInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: FindConflictingCommands5

 public void FindConflictingCommands5()
 {
     var commands = Create("::a","::z, h");
     var inputs = new KeyInput[] { new KeyInput('z') };
     var list = KeyBindingService.FindConflictingCommands(commands, new HashSet<KeyInput>(inputs));
     Assert.AreEqual(1, list.Count);
 }
开发者ID:ameent,项目名称:VsVim,代码行数:7,代码来源:KeyBindingServiceTest.cs


示例17: FindConflictingCommands7

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


示例18: HandleKeyPressInner

        public override bool HandleKeyPressInner(KeyInput e)
        {
            if (World == null) return false;
            if (World.LocalPlayer == null) return false;

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


示例19: VerifyConvert

 private void VerifyConvert(VSConstants.VSStd97CmdID cmd, KeyInput ki, EditCommandKind kind)
 {
     EditCommand command;
     Assert.True(OleCommandUtil.TryConvert(VSConstants.GUID_VSStandardCommandSet97, (uint)cmd, IntPtr.Zero, VimKeyModifiers.None, out command));
     Assert.Equal(ki, command.KeyInput);
     Assert.Equal(kind, command.EditCommandKind);
 }
开发者ID:Yzzl,项目名称:VsVim,代码行数:7,代码来源:OleCommandUtilTest.cs


示例20: HandleKeyPress

		public override bool HandleKeyPress(KeyInput e)
		{
			if (e.Event == KeyInputEvent.Down)
			{
				var hk = Hotkey.FromKeyInput(e);

				if (hk == Game.Settings.Keys.DevReloadChromeKey)
				{
					ChromeProvider.Initialize(Game.ModData.Manifest.Chrome);
					return true;
				}

				if (hk == Game.Settings.Keys.HideUserInterfaceKey)
				{
					foreach (var child in this.Children)
						child.Visible ^= true;

					return true;
				}

				if (hk == Game.Settings.Keys.TakeScreenshotKey)
				{
					if (e.Event == KeyInputEvent.Down)
						Game.TakeScreenshot = true;

					return true;
				}
			}

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# KeyModifiers类代码示例发布时间:2022-05-24
下一篇:
C# KeyInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap