public static bool QWaitFor(WaitForCb cb, int ms) { var realCb = new QTestInterop.WaitForCb(() => cb() ? 1 : 0); var handle = GCHandle.Alloc(realCb); var result = Interop.QTest.QWaitFor(Marshal.GetFunctionPointerForDelegate(realCb), ms); handle.Free(); return(result == 1); }
public static bool QWaitFor(WaitForCb cb, TimeSpan time) { return(QWaitFor(cb, (int)time.TotalMilliseconds)); }