private void ShowError(BackgroundErrorEventArgs e) { if (Visible) { MessageBox.Show(e.Exception.ToString(), "Don't panic, but something went wrong", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { trayIcon.ShowBalloonTip(5000, DefaultTitle, e.Exception.ToString(), ToolTipIcon.Error); } }
void HandleBackgroundError(object sender, BackgroundErrorEventArgs e) { if (InvokeRequired) { Invoke(new InvokeMethod(delegate { FinishWorkitemPopulation(); ShowError(e); } )); } else { FinishWorkitemPopulation(); ShowError(e); } }