public static void HandleException(Exception ex, string toEmailAddress, System.Windows.Forms.IWin32Window owner) { lock (exceptionFormLock) { if (exceptionForm == null) { exceptionForm = new Forms.ExceptionForm(ex, toEmailAddress); if (owner != null) { try { exceptionForm.ShowDialog(owner); } catch { exceptionForm.ShowDialog(); } } else { exceptionForm.ShowDialog(); } } else { exceptionForm.SetException(ex); exceptionForm.SetEmailAddress(toEmailAddress); if (exceptionForm.IsClosed) { exceptionForm.IsClosed = false; if (owner != null) { exceptionForm.ShowDialog(owner); } else { exceptionForm.ShowDialog(); } } } } }