public override void invoke(MainAction mainAction, bool wait) { try { if (!View.IsHandleCreated) { return; } if (View.InvokeRequired) { //currently only sync if (true) { View.Invoke(new AsyncDelegate(mainAction.run), null); } else { View.BeginInvoke(new AsyncDelegate(mainAction.run), null); } } else { mainAction.run(); } } catch (ObjectDisposedException) { //happens because there is no synchronization between the lifecycle of a form and callbacks of background threads. //catch silently } }
public override void invoke(MainAction runnable, bool wait) { if (!runnable.isValid()) { return; } try { if (!View.IsHandleCreated) { return; } if (View.InvokeRequired) { //currently only sync if (true) { View.Invoke(new AsyncDelegate(runnable.run), null); } else { View.BeginInvoke(new AsyncDelegate(runnable.run), null); } } else { runnable.run(); } } catch (ObjectDisposedException) { //happens because there is no synchronization between the lifecycle of a form and callbacks of background threads. //catch silently } catch (Exception e) { Log.error("Unhandled exception during invoke", e); throw e; } }
public override void invoke(MainAction mainAction, bool wait) { mainAction.run(); }