本文整理汇总了C#中VimKey类的典型用法代码示例。如果您正苦于以下问题:C# VimKey类的具体用法?C# VimKey怎么用?C# VimKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VimKey类属于命名空间,在下文中一共展示了VimKey类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryProcessDrag
private void TryProcessDrag(MouseEventArgs e, MouseButtonState state, VimKey vimKey)
{
if (state == MouseButtonState.Pressed)
{
e.Handled = TryProcess(vimKey);
}
}
示例2: VerifyConvert
/// <summary>
/// Verify we can convert the given VimKey to the specified command id
/// </summary>
private void VerifyConvert(VimKey vimKey, VSConstants.VSStd2KCmdID cmd)
{
var keyInput = KeyInputUtil.VimKeyToKeyInput(vimKey);
OleCommandData oleCommandData;
Assert.True(OleCommandUtil.TryConvert(keyInput, false, out oleCommandData));
Assert.Equal(VSConstants.VSStd2K, oleCommandData.Group);
Assert.Equal(new OleCommandData(cmd), oleCommandData);
}
示例3: TrySpecialVimKeyToVirtualKey
/// <summary>
/// Get the virtual key code for the provided VimKey. This will only work for Vim keys which
/// are meant for very specific keys. It doesn't work for alphas
///
/// All constant values derived from the list at the following
/// location
/// http://msdn.microsoft.com/en-us/library/ms645540(VS.85).aspx
///
/// </summary>
private static bool TrySpecialVimKeyToVirtualKey(VimKey vimKey, out uint virtualKeyCode)
{
var found = true;
switch (vimKey)
{
case VimKey.Enter: virtualKeyCode = 0xD; break;
case VimKey.Tab: virtualKeyCode = 0x9; break;
case VimKey.Escape: virtualKeyCode = 0x1B; break;
case VimKey.LineFeed: virtualKeyCode = 0; break;
case VimKey.Back: virtualKeyCode = 0x8; break;
case VimKey.Delete: virtualKeyCode = 0x2E; break;
case VimKey.Left: virtualKeyCode = 0x25; break;
case VimKey.Up: virtualKeyCode = 0x26; break;
case VimKey.Right: virtualKeyCode = 0x27; break;
case VimKey.Down: virtualKeyCode = 0x28; break;
case VimKey.Help: virtualKeyCode = 0x2F; break;
case VimKey.Insert: virtualKeyCode = 0x2D; break;
case VimKey.Home: virtualKeyCode = 0x24; break;
case VimKey.End: virtualKeyCode = 0x23; break;
case VimKey.PageUp: virtualKeyCode = 0x21; break;
case VimKey.PageDown: virtualKeyCode = 0x22; break;
case VimKey.Break: virtualKeyCode = 0x03; break;
case VimKey.F1: virtualKeyCode = 0x70; break;
case VimKey.F2: virtualKeyCode = 0x71; break;
case VimKey.F3: virtualKeyCode = 0x72; break;
case VimKey.F4: virtualKeyCode = 0x73; break;
case VimKey.F5: virtualKeyCode = 0x74; break;
case VimKey.F6: virtualKeyCode = 0x75; break;
case VimKey.F7: virtualKeyCode = 0x76; break;
case VimKey.F8: virtualKeyCode = 0x77; break;
case VimKey.F9: virtualKeyCode = 0x78; break;
case VimKey.F10: virtualKeyCode = 0x79; break;
case VimKey.F11: virtualKeyCode = 0x7a; break;
case VimKey.F12: virtualKeyCode = 0x7b; break;
case VimKey.KeypadMultiply: virtualKeyCode = 0x6A; break;
case VimKey.KeypadPlus: virtualKeyCode = 0x6B; break;
case VimKey.KeypadMinus: virtualKeyCode = 0x6D; break;
case VimKey.KeypadDecimal: virtualKeyCode = 0x6E; break;
case VimKey.KeypadDivide: virtualKeyCode = 0x6F; break;
case VimKey.Keypad0: virtualKeyCode = 0x60; break;
case VimKey.Keypad1: virtualKeyCode = 0x61; break;
case VimKey.Keypad2: virtualKeyCode = 0x62; break;
case VimKey.Keypad3: virtualKeyCode = 0x63; break;
case VimKey.Keypad4: virtualKeyCode = 0x64; break;
case VimKey.Keypad5: virtualKeyCode = 0x65; break;
case VimKey.Keypad6: virtualKeyCode = 0x66; break;
case VimKey.Keypad7: virtualKeyCode = 0x67; break;
case VimKey.Keypad8: virtualKeyCode = 0x68; break;
case VimKey.Keypad9: virtualKeyCode = 0x69; break;
default:
virtualKeyCode = 0;
found = false;
break;
}
return found;
}
示例4: TryProcess
private bool TryProcess(VimKey vimKey)
{
var keyInput = KeyInputUtil.VimKeyToKeyInput(vimKey);
if (_vimBuffer.CanProcess(keyInput))
{
return _vimBuffer.Process(keyInput).IsAnyHandled;
}
return false;
}
示例5: CreateKeyInput
internal static KeyInput CreateKeyInput(
VimKey key = VimKey.NotWellKnown,
KeyModifiers mod = KeyModifiers.None,
char? c = null)
{
return new KeyInput(
key,
mod,
c.HasValue ? FSharpOption<char>.Some(c.Value) : FSharpOption<char>.None);
}
示例6: TryConvertToKey
/// <summary>
/// Try and convert the VimKey to a WPF key. Note this is a lossy conversion as modifiers
/// will be dropped. So for example UpperN will still map to Key.N but the fidelity of
/// shift will be lost
/// </summary>
internal bool TryConvertToKey(VimKey vimKey, out IEnumerable<Key> keys)
{
IEnumerable<KeyState> keyStates;
if (GetOrCreateKeyboardMap().TryGetKey(vimKey, out keyStates))
{
keys = keyStates.Select(x => x.Key);
return true;
}
keys = null;
return false;
}
示例7: TryGetKey
internal bool TryGetKey(VimKey vimKey, out Key key)
{
int virtualKeyCode;
if (!TryVimKeyToVirtualKey(vimKey, out virtualKeyCode))
{
key = Key.None;
return false;
}
key = KeyInterop.KeyFromVirtualKey(virtualKeyCode);
return true;
}
示例8: TryProcess
internal bool TryProcess(VimKey vimKey)
{
var keyInput = KeyInputUtil.VimKeyToKeyInput(vimKey);
// If the user has explicitly set the mouse to be <nop> then we don't want to report this as
// handled. Otherwise it will swallow the mouse event and as a consequence disable other
// features that begin with a mouse click.
//
// There is really no other way for the user to opt out of mouse behavior besides mapping the
// key to <nop> otherwise that would be done here.
var keyInputSet = _vimBuffer.GetKeyInputMapping(keyInput).KeyInputSet;
if (keyInputSet.Length > 0 && keyInputSet.KeyInputs[0].Key == VimKey.Nop)
{
return false;
}
if (_vimBuffer.CanProcess(keyInput))
{
return _vimBuffer.Process(keyInput).IsAnyHandled;
}
return false;
}
示例9: TryConvertToKey
/// <summary>
/// Try and convert the VimKey to a WPF key. Note this is a lossy conversion as modifiers
/// will be dropped. So for example UpperN will still map to Key.N but the fidelity of
/// shift will be lost
/// </summary>
public static bool TryConvertToKey(VimKey vimKey, out Key key)
{
ModifierKeys modifierKeys;
return TryConvertToKey(vimKey, out key, out modifierKeys);
}
示例10: IsMappedByChar
public static bool IsMappedByChar(VimKey vimKey)
{
return KeyboardMap.IsMappedByCharacter(vimKey);
}
示例11: TrySpecialVimKeyToKey
internal static bool TrySpecialVimKeyToKey(VimKey vimKey, out Key key)
{
return s_vimKeyToWpfKeyMap.TryGetValue(vimKey, out key);
}
示例12: VerifySpecial
private void VerifySpecial(VimKey vimKey, KeyModifiers keyModifiers = KeyModifiers.None)
{
var keyInput = KeyInputUtil.ApplyModifiersToVimKey(vimKey, keyModifiers);
Assert.True(_reportDesignerUtil.IsSpecialHandled(keyInput));
}
示例13: TryConvertToKey
public static bool TryConvertToKey(VimKey vimKey, out Key key)
{
return GetOrCreateKeyboardMap().TryGetKey(vimKey, out key);
}
示例14: AssertMotion
private void AssertMotion(VimKey key, Motion motion)
{
AssertMotion(KeyInputUtil.VimKeyToKeyInput(key), motion);
}
示例15: WellKnownBothWays
private void WellKnownBothWays(VimKey wellKnownKey, Key key)
{
var left = KeyInputUtil.VimKeyToKeyInput(wellKnownKey);
KeyInput right;
Assert.IsTrue(KeyUtil.TryConvertToKeyInput(key, out right));
Assert.AreEqual(left, right);
}