Example #1
0
 public void SendReportToWebService(IReportSendEvent reportSendEvent = null)
 {
     /*
      * var webService = new WebServiceSender(_reportInfo, reportSendEvent ?? new SilentSendEvent());
      * webService.Send(CreateExceptionReport().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());
        }
        /// <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());
        }
Example #4
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());
        }
Example #5
0
        public bool SendReportToWebPage(IReportSendEvent reportSendEvent = null)
        {
            //TODO: change to async and create a delegate to return the result of opperation

            // validate URL
            if (string.IsNullOrEmpty(_reportInfo.WebReportUrl))
            {
                return(false);
            }
            if (!Uri.IsWellFormedUriString(_reportInfo.WebReportUrl, UriKind.RelativeOrAbsolute))
            {
                return(false);
            }

            var webPage = new WebPageSender(_reportInfo, reportSendEvent ?? new SilentSendEvent());

            return(webPage.Send(CreateExceptionReport().ToString()));
        }
Example #6
0
        /// <summary>
        /// Sends the report by email (assumes SMTP - a silent/async send)
        /// <param name="reportSendEvent">Implementation of cref="IEmailSendEvent"/ to receive completed event and
        /// error object, if any</param>
        /// <returns>whether the initial mail connection setup succeeded - not mail sent - use emailSendEvent to
        /// determine send/success</returns>
        /// </summary>
        public void SendReportByEmail(IReportSendEvent reportSendEvent = null)
        {
            var mailSender = new MailSender(_reportInfo, reportSendEvent ?? new SilentSendEvent());

            mailSender.SendSmtp(CreateExceptionReport().ToString());
        }
 internal MailSender(ExceptionReportInfo reportInfo, IReportSendEvent reportEvent)
 {
     _config      = reportInfo;
     _reportEvent = reportEvent;
     _attacher    = new Attacher(reportInfo);
 }
Example #8
0
 public MapiMailSender(ExceptionReportInfo reportInfo, IReportSendEvent sendEvent) :
     base(reportInfo, sendEvent)
 {
 }
 protected MailSender(ExceptionReportInfo reportInfo, IReportSendEvent sendEvent, IScreenShooter screenShooter)
 {
     _config    = reportInfo;
     _sendEvent = sendEvent;
     _attacher  = new Attacher(reportInfo, screenShooter);
 }
 protected MailSender(ExceptionReportInfo reportInfo, IReportSendEvent sendEvent)
 {
     _config    = reportInfo;
     _sendEvent = sendEvent;
     _attacher  = new Attacher(reportInfo);
 }
 public MapiMailSender(ExceptionReportInfo reportInfo, IReportSendEvent sendEvent, IScreenShooter screenShooter) :
     base(reportInfo, sendEvent, screenShooter)
 {
 }
 internal WebServiceSender(ExceptionReportInfo info, IReportSendEvent sendEvent)
 {
     _info      = info;
     _sendEvent = sendEvent;
 }
Example #13
0
 public SenderFactory(ExceptionReportInfo config, IReportSendEvent sendEvent, IScreenShooter screenShooter)
 {
     _config        = config;
     _sendEvent     = sendEvent;
     _screenShooter = screenShooter;
 }
Example #14
0
 public SenderFactory(ExceptionReportInfo config, IReportSendEvent sendEvent)
 {
     _config    = config;
     _sendEvent = sendEvent;
 }
 public void SetUp()
 {
     _sendEvent = new Mock <IReportSendEvent>().Object;
 }