本文整理汇总了C#中InputBuilder.AddKeyDown方法的典型用法代码示例。如果您正苦于以下问题:C# InputBuilder.AddKeyDown方法的具体用法?C# InputBuilder.AddKeyDown怎么用?C# InputBuilder.AddKeyDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputBuilder
的用法示例。
在下文中一共展示了InputBuilder.AddKeyDown方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddKeyDown
public void AddKeyDown()
{
var builder = new InputBuilder();
Assert.That(builder.ToArray(), Is.Empty);
builder.AddKeyDown(VirtualKeyCode.VK_A);
Assert.That(builder.Count(), Is.EqualTo(1));
Assert.That(builder[0].Type, Is.EqualTo((uint)InputType.Keyboard));
Assert.That(builder[0].Data.Keyboard.KeyCode, Is.EqualTo((ushort)VirtualKeyCode.VK_A));
}
示例2: AddKeyDown
public void AddKeyDown()
{
var builder = new InputBuilder();
Assert.IsFalse(builder.ToArray().Any());
builder.AddKeyDown(VirtualKeyCode.VK_A);
Assert.AreEqual(builder.Count(), 1);
Assert.AreEqual(builder[0].Type,(uint)InputType.Keyboard);
Assert.AreEqual(builder[0].Data.Keyboard.KeyCode, (ushort)VirtualKeyCode.VK_A);
}
示例3: ModifiedKeyStroke
/// <summary>
/// Simulates a modified keystroke where there is one modifier and multiple keys like CTRL-K-C where CTRL is the modifierKey and K and C are the keys.
/// The flow is Modifier KeyDown, Keys Press in order, Modifier KeyUp.
/// </summary>
/// <param name="modifierKey">The modifier key</param>
/// <param name="keyCodes">The list of keys to simulate</param>
public void ModifiedKeyStroke(VirtualKeyCode modifierKey, IEnumerable<VirtualKeyCode> keyCodes)
{
var builder = new InputBuilder();
builder.AddKeyDown(modifierKey);
if (keyCodes != null) keyCodes.ToList().ForEach(x => builder.AddKeyPress(x));
builder.AddKeyUp(modifierKey);
SendSimulatedInput(builder.ToArray());
}
示例4: ModifiersDown
private void ModifiersDown(InputBuilder builder, IEnumerable<VirtualKeyCode> modifierKeyCodes)
{
if (modifierKeyCodes == null) return;
foreach (var key in modifierKeyCodes) builder.AddKeyDown(key);
}
示例5: ModifiersDown
private void ModifiersDown(InputBuilder builder, IEnumerable<Win32Constants.VirtualKeys> modifierKeyCodes){
if (modifierKeyCodes == null) return;
foreach (Win32Constants.VirtualKeys key in modifierKeyCodes) builder.AddKeyDown(key);
}
示例6: ModifiersDown
private void ModifiersDown(InputBuilder builder, IEnumerable<DirectInputKeyCode> modifierDikCodes)
{
if (modifierDikCodes == null) return;
foreach (var dik in modifierDikCodes) builder.AddKeyDown(dik);
}