private static void ShowToast(string shortUserLevelMessage, Exception exception, string fullDetailedMessage)
{
var formForSynchronizing = Application.OpenForms.Cast<Form>().Last();
if (formForSynchronizing.InvokeRequired)
{
formForSynchronizing.BeginInvoke(new Action(() =>
{
ShowToast(shortUserLevelMessage, exception, fullDetailedMessage);
}));
return;
}
var toast = new ToastNotifier();
toast.ToastClicked +=
(s, e) => { SIL.Reporting.ErrorReport.ReportNonFatalExceptionWithMessage(exception, fullDetailedMessage); };
toast.Image.Image = ToastNotifier.WarningBitmap;
toast.Show(shortUserLevelMessage, "Report", 5);
}