You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AutoHotInterception/C#/TestApp/SetStateTester.cs

35 lines
914 B
C#

using AutoHotInterception;
using System;
using TestApp.Helpers;
namespace TestApp
{
class SetStateTester
{
public SetStateTester(TestDevice device, AhkKey key)
{
Console.WriteLine($"Test key: {key.Name} - code {key.LogCode()}");
Console.WriteLine("Enter to toggle Subscription state");
var im = new Manager();
var devId = device.GetDeviceId();
if (devId == 0) return;
var state = true;
im.SubscribeKey(devId, key.Code, true, new Action<int>(OnKeyEvent));
while (true)
{
Console.ReadLine();
state = !state;
Console.WriteLine($"SetState({state})");
im.SetState(state);
}
}
public void OnKeyEvent(int value)
{
Console.WriteLine($"State: {value}");
}
}
}