public static void StartHook(PhysicalKeys[] listenFor)
{
if (listenFor == null || listenFor.Length == 0)
{
throw new ArgumentException("listenFor; null or 0 length");
}
m_listenFor = listenFor.Select(enu => (int)enu).ToArray();
if (!isRunninghook)
{
isRunninghook = true;
hookThread = new System.Threading.Timer((callback) =>
{
while (true)
{
for (int i = 0; i < m_listenFor.Length; i++)
{
if (DllImportCaller.lib.GetAsyncKeyState7(m_listenFor[i]) != 0) //OPTIMIZE, SO FEW CALLS POSSIBLE; Phone.KeyboardHook.IsKeyDown(m_listenFor[i]))
{
if (OnKeyDown != null)
{
OnKeyDown(null, (PhysicalKeys)m_listenFor[i]);
}
}
}
System.Threading.Thread.Sleep(500);
}
}, null, 0, System.Threading.Timeout.Infinite);
}
}
public static void StopHook()