public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
System.Diagnostics.Stopwatch sw = System.Diagnostics.Stopwatch.StartNew();
bool keyUsed = false;
while(sw.ElapsedMilliseconds < 500)
{
if (BFS.Input.IsKeyDown("17"))
{
keyUsed = true;
break; // Immediately leave the loop
}
//BFS.General.ThreadWait(1); // 100x takes 3.15s
System.Threading.Thread.Sleep(1); // 100x takes 1.55s
}
if (keyUsed)
{
BFS.Dialog.ShowTrayMessage($"Key was used after {sw.Elapsed.TotalSeconds:0.00}s");
}
else
{
BFS.Dialog.ShowTrayMessage($"Key was NOT used after {sw.Elapsed.TotalSeconds:0.00}s");
}
}
}