private IAsyncResult MainFormBeginInvoke(MainForm_Events formEvent, EventArgs args = null, object sender = null) { return(MainForm.BeginInvoke((MethodInvoker) delegate { try { formEvent(sender ?? MainForm, args ?? new EventArgs()); } catch (Exception ex) { Exception = ex; } })); }
private void MainFormInvoke(MainForm_Events formEvent, EventArgs args = null, object sender = null) { DoEventsUntilFormReadyAndResetFormReady(); EndInvokeAndThrowException(MainFormBeginInvoke(formEvent, args, sender)); }