fix(Program.cs): reduce delay in HandleWaitingToAdvance and handle sequence event asynchronously
This commit is contained in:
@@ -222,8 +222,8 @@ namespace DD2Switcher {
|
||||
|
||||
private static void HandleWaitingToAdvance() {
|
||||
// Start timer to advance after N milliseconds
|
||||
Console.WriteLine($"Starting 500ms timer in WAITING_TO_ADVANCE state");
|
||||
Task.Delay(500).ContinueWith(_ => {
|
||||
Console.WriteLine($"Starting 20ms timer in WAITING_TO_ADVANCE state");
|
||||
Task.Delay(20).ContinueWith(_ => {
|
||||
if (CurrentState == SequenceState.WAITING_TO_ADVANCE) {
|
||||
CurrentState = SequenceState.ADVANCE;
|
||||
Console.WriteLine($"Timer expired, transitioning to ADVANCE state");
|
||||
@@ -321,7 +321,8 @@ namespace DD2Switcher {
|
||||
if (wParamInt == WM_LBUTTONDOWN || wParamInt == WM_RBUTTONDOWN || wParamInt == WM_MBUTTONDOWN) {
|
||||
if (CurrentState == SequenceState.WAITING_FOR_EVENT) {
|
||||
Console.WriteLine($"Mouse click detected in state: {CurrentState}");
|
||||
HandleSequenceEvent();
|
||||
// Handle sequence event asynchronously to avoid interfering with mouse event processing
|
||||
Task.Run(() => HandleSequenceEvent());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user