/// <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 exception report using the configured send method
        /// </summary>
        public async Task SendReport()
        {
            View.EnableEmailButton = false;
            View.ShowProgressBar   = true;

            var sender = new SenderFactory(ReportInfo, View).Get();

            View.ProgressMessage = sender.ConnectingMessage;

            try
            {
                await Task.Run(() =>
                {
                    //string command = "mailto:info[at]codegain.com?subject=The Subject&bcc=vrrave[at]codegaim.com";
                    //System.Diagnostics.Process.Start(command);

                    var report = ReportInfo.IsSimpleMAPI() || ReportInfo.SendMethod == ReportSendMethod.Mailto? 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();
                }
            }
        }
Example #3
0
        /// <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, new WinFormsScreenShooter()).Get();

            View.ProgressMessage = sender.ConnectingMessage;

            try
            {
                var report = ReportInfo.IsSimpleMAPI() ? new EmailReporter(ReportInfo).Create() : CreateReport();
                sender.Send(report);
            }
            catch (Exception exception)
            {
                View.Completed(false);
                View.ShowError(Resources.Unable_to_setup + $" {sender.Description}" +
                               Environment.NewLine + exception.Message, exception);
            }
            finally
            {
                if (ReportInfo.IsSimpleMAPI())
                {
                    View.MapiSendCompleted();
                }
            }
        }
        /// <summary>
        /// Send the report 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</param>
        /// <param name="exceptions">The exception/s to include in the report</param>
        public void Send(IReportSendEvent sendEvent = null, params Exception[] exceptions)
        {
            _reportInfo.SetExceptions(exceptions);

            var generator = new ReportGenerator(_reportInfo);
            var sender    = new SenderFactory(_reportInfo, sendEvent ?? new SilentSendEvent()).Get();

            sender.Send(generator.Generate().ToString());
        }
        /// <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());
        }
Example #6
0
        /// <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="screenShooter">The screen-shotting code might be specific to WinForms, so this is an option to send anything that implements IScreenshooter</param>
        /// <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>
        protected void Send(IScreenShooter screenShooter, IReportSendEvent sendEvent = null, params Exception[] exceptions)
        {
            _info.SetExceptions(exceptions);

            var sender = new SenderFactory(_info, sendEvent ?? new SilentSendEvent(), screenShooter).Get();
            var report = new ReportGenerator(_info);

            sender.Send(report.Generate());
        }