/// <summary> /// Send the exception report using the configured send method /// </summary> public void SendReport() { View.EnableEmailButton = false; View.ShowProgressBar = true; var sender = new SenderFactory(ReportInfo, View).Get(); View.ProgressMessage = sender.ConnectingMessage; try { var report = ReportInfo.IsSimpleMAPI() ? CreateEmailReport() : CreateReport(); sender.Send(report); } catch (Exception exception) { // most exceptions will be thrown in the Sender - this is just a backup View.Completed(false); View.ShowError(string.Format("Unable to setup {0}", sender.Description) + Environment.NewLine + exception.Message, exception); } finally { if (ReportInfo.IsSimpleMAPI()) { View.MapiSendCompleted(); } } }
/// <summary> /// Send the report, asynchronously, without showing a dialog (silent send) /// <see cref="ExceptionReportInfo.SendMethod"/>must be SMTP or WebService, else this is ignored (silently) /// </summary> /// <param name="sendEvent">Provide implementation of IReportSendEvent to receive error/updates on calling thread</param> /// <param name="exceptions">The exception/s to include in the report</param> public void Send(IReportSendEvent sendEvent = null, params Exception[] exceptions) { _info.SetExceptions(exceptions); var sender = new SenderFactory(_info, sendEvent ?? new SilentSendEvent()).Get(); var report = new ReportGenerator(_info); sender.Send(report.Generate()); }