Update test apps

This commit is contained in:
Clive Galway 2019-05-14 19:37:07 +01:00
parent f072c3bb57
commit 281f7fe786
4 changed files with 78 additions and 32 deletions

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoHotInterception;
namespace TestApp
{
public class KeyboardTester
{
public KeyboardTester()
{
var im = new Manager();
var devId = im.GetKeyboardId(0x04F2, 0x0112);
if (devId == 0) return;
im.SubscribeKey(devId, 0x2, false, new Action<int>(value =>
{
Console.WriteLine($"State: {value}");
}));
}
}
}

48
C#/TestApp/MouseTester.cs Normal file
View File

@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoHotInterception;
namespace TestApp
{
public class MouseTester
{
public MouseTester()
{
var im = new Manager();
var mouseHandle = "HID\\VID_046D&PID_C52B&REV_2407&MI_02&Qid_1028&WI_01&Class_00000004";
var devId = im.GetMouseIdFromHandle(mouseHandle);
var counter = 0;
if (devId != 0)
{
im.SubscribeMouseButton(devId, 1, true, new Action<int>(value =>
{
Console.WriteLine("RButton Button Value: " + value);
}));
im.SubscribeMouseButton(devId, 3, true, new Action<int>(value =>
{
Console.WriteLine("XButton1 Button Value: " + value);
}));
im.SubscribeMouseButton(devId, 4, true, new Action<int>(value =>
{
Console.WriteLine("XButton2 Button Value: " + value);
}));
im.SubscribeMouseButton(devId, 5, true, new Action<int>(value =>
{
Console.Write("WheelVertical Value: " + value);
var mycounter = counter;
mycounter++;
Console.WriteLine(" Counter: " + mycounter);
counter = mycounter;
}));
}
Console.ReadLine();
}
}
}

View File

@ -7,38 +7,8 @@ namespace TestApp
{
private static void Main()
{
var im = new Manager();
var mouseHandle = "HID\\VID_046D&PID_C52B&REV_2407&MI_02&Qid_1028&WI_01&Class_00000004";
var mouseId = im.GetMouseIdFromHandle(mouseHandle);
var counter = 0;
if (mouseId != 0)
{
im.SubscribeMouseButton(mouseId, 1, true, new Action<int>(value =>
{
Console.WriteLine("RButton Button Value: " + value);
}));
im.SubscribeMouseButton(mouseId, 3, true, new Action<int>(value =>
{
Console.WriteLine("XButton1 Button Value: " + value);
}));
im.SubscribeMouseButton(mouseId, 4, true, new Action<int>(value =>
{
Console.WriteLine("XButton2 Button Value: " + value);
}));
im.SubscribeMouseButton(mouseId, 5, true, new Action<int>(value =>
{
Console.Write("WheelVertical Value: " + value);
var mycounter = counter;
mycounter++;
Console.WriteLine(" Counter: " + mycounter);
counter = mycounter;
}));
}
Console.ReadLine();
//var mt = new MouseTester();
var kt = new KeyboardTester();
}
}
}

View File

@ -42,6 +42,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="KeyboardTester.cs" />
<Compile Include="MouseTester.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>