public static void AwaitTask(Task task, QEventLoop.ProcessEventsFlag flags, TimeSpan?timeout = null) { while (!task.IsCompleted) { ProcessEvents(flags, timeout); } task.GetAwaiter().GetResult(); }
public static void ProcessEvents(QEventLoop.ProcessEventsFlag flags, TimeSpan?timeout = null) { if (timeout == null) { Interop.QCoreApplication.ProcessEvents((int)flags); } else { Interop.QCoreApplication.ProcessEventsWithTimeout((int)flags, (int)timeout.Value.TotalMilliseconds); } }