mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
This commit is contained in:
@@ -212,16 +212,8 @@ public static partial class Application // Run (Begin, Run, End, Stop)
|
|||||||
|
|
||||||
NotifyNewRunState?.Invoke (toplevel, new (rs));
|
NotifyNewRunState?.Invoke (toplevel, new (rs));
|
||||||
|
|
||||||
if (!ConsoleDriver.RunningUnitTests)
|
// Force an Idle event so that an Iteration (and Refresh) happen.
|
||||||
{
|
Invoke (() => { });
|
||||||
// Force an Idle event to be added to timeout outside the Application.MainThreadId,
|
|
||||||
// so that an Iteration (and Refresh) happen in the Application.MainThreadId
|
|
||||||
Task.Run (() =>
|
|
||||||
{
|
|
||||||
Invoke (() => { });
|
|
||||||
Task.Delay (1).Wait ();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return rs;
|
return rs;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -275,6 +275,8 @@ public class ApplicationImpl : IApplication
|
|||||||
if (Application.MainThreadId == Thread.CurrentThread.ManagedThreadId)
|
if (Application.MainThreadId == Thread.CurrentThread.ManagedThreadId)
|
||||||
{
|
{
|
||||||
action ();
|
action ();
|
||||||
|
WakeupMainLoop ();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,9 +296,14 @@ public class ApplicationImpl : IApplication
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
// Ensure the action is executed in the main loop
|
WakeupMainLoop ();
|
||||||
// Wakeup mainloop if it's waiting for events
|
|
||||||
Application.MainLoop.Wakeup ();
|
void WakeupMainLoop ()
|
||||||
|
{
|
||||||
|
// Ensure the action is executed in the main loop
|
||||||
|
// Wakeup mainloop if it's waiting for events
|
||||||
|
Application.MainLoop?.Wakeup ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
Reference in New Issue
Block a user