From 281f7fe786401d2f2bd103289a1c9ba814180d63 Mon Sep 17 00:00:00 2001 From: Clive Galway Date: Tue, 14 May 2019 19:37:07 +0100 Subject: [PATCH] Update test apps --- C#/TestApp/KeyboardTester.cs | 26 +++++++++++++++++++ C#/TestApp/MouseTester.cs | 48 ++++++++++++++++++++++++++++++++++++ C#/TestApp/Program.cs | 34 ++----------------------- C#/TestApp/TestApp.csproj | 2 ++ 4 files changed, 78 insertions(+), 32 deletions(-) create mode 100644 C#/TestApp/KeyboardTester.cs create mode 100644 C#/TestApp/MouseTester.cs diff --git a/C#/TestApp/KeyboardTester.cs b/C#/TestApp/KeyboardTester.cs new file mode 100644 index 0000000..9050089 --- /dev/null +++ b/C#/TestApp/KeyboardTester.cs @@ -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(value => + { + Console.WriteLine($"State: {value}"); + })); + } + } +} diff --git a/C#/TestApp/MouseTester.cs b/C#/TestApp/MouseTester.cs new file mode 100644 index 0000000..1529cea --- /dev/null +++ b/C#/TestApp/MouseTester.cs @@ -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(value => + { + Console.WriteLine("RButton Button Value: " + value); + })); + im.SubscribeMouseButton(devId, 3, true, new Action(value => + { + Console.WriteLine("XButton1 Button Value: " + value); + })); + im.SubscribeMouseButton(devId, 4, true, new Action(value => + { + Console.WriteLine("XButton2 Button Value: " + value); + })); + im.SubscribeMouseButton(devId, 5, true, new Action(value => + { + Console.Write("WheelVertical Value: " + value); + var mycounter = counter; + mycounter++; + Console.WriteLine(" Counter: " + mycounter); + counter = mycounter; + })); + } + + Console.ReadLine(); + } + } +} diff --git a/C#/TestApp/Program.cs b/C#/TestApp/Program.cs index 7097245..5acb967 100644 --- a/C#/TestApp/Program.cs +++ b/C#/TestApp/Program.cs @@ -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(value => - { - Console.WriteLine("RButton Button Value: " + value); - })); - im.SubscribeMouseButton(mouseId, 3, true, new Action(value => - { - Console.WriteLine("XButton1 Button Value: " + value); - })); - im.SubscribeMouseButton(mouseId, 4, true, new Action(value => - { - Console.WriteLine("XButton2 Button Value: " + value); - })); - im.SubscribeMouseButton(mouseId, 5, true, new Action(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(); } } } \ No newline at end of file diff --git a/C#/TestApp/TestApp.csproj b/C#/TestApp/TestApp.csproj index b74539d..29febad 100644 --- a/C#/TestApp/TestApp.csproj +++ b/C#/TestApp/TestApp.csproj @@ -42,6 +42,8 @@ + +