private void RunOnWinFormsThread(Action action) { if (ShouldCancel) { return; } try { _owner.BeginInvoke((Action)(() => action())).AsyncWaitHandle.WaitOne(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine("Warning: Dispatch to WinForms thread failed: " + e.Message); } }