Пример #1
0
 public void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
 {
     reporter.Show(e.Exception);
     if (!string.IsNullOrEmpty(reporter.Config.WebReportUrl))
     {
         if (CheckForInternetConnection())
         {
             reporter.Send(SharkErrorReporter.Core.ExceptionReportInfo.SendMethod.WebPage, e.Exception);
         }
     }
 }
Пример #2
0
        void Send_Silent_Report(object sender, EventArgs e)
        {
            try
            {
                SomeMethodThatThrows();
            }
            catch (Exception exception)
            {
                var er = new ExceptionReporter();

                //	ConfigureSmtpEmail(er.Config);
                ConfigureWebService(er.Config);                         //toggle which type to configure
                er.Send(exception);
            }
        }
Пример #3
0
        void Send_Silent_Report(object sender, EventArgs e)
        {
            try
            {
                SomeMethodThatThrows();
            }
            catch (Exception exception)
            {
                var er = new ExceptionReporter();

//				ConfigureSmtpEmail(config);
                ConfigureWebService(er.Config);                         //toggle which type to configure
                er.Send(exception);

                // don't really need ExceptionReportGenerator (as used below) because the ExceptionReporter Send()
                // method (above) wraps it
                // var exceptionReportGenerator = new ExceptionReportGenerator(config);
                // exceptionReportGenerator.SendReportByEmail();
            }
        }
Пример #4
0
        private static void Main()
        {
            ErrorHandler errorHandler = new ErrorHandler();

            log4net.ILog log;
            log4net.Config.XmlConfigurator.Configure();
            log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            Application.ThreadException += (sender, args) =>
            {
                log.Error(sender, args.Exception);
                errorHandler.EmailExceptionAndActionLogToSupport(sender, args.Exception);
                ExceptionReporter er = new ExceptionReporter
                {
                    Config =
                    {
                        AppName                   = "SPM Connect",
                        ShowFullDetail            = false,
                        CompanyName               = "SPM Automation",
                        TitleText                 = "SPM Connect Error Report",
                        EmailReportAddress        = "*****@*****.**",
                        TakeScreenshot            = true,                  // attached if sending email
                        SendMethod                = ReportSendMethod.SMTP, // also WebService/SimpleMAPI
                        SmtpServer                = "spmautomation-com0i.mail.protection.outlook.com",
                        SmtpPort                  =                                                          25,
                        SmtpUseDefaultCredentials = true,
                        SmtpFromAddress           = "*****@*****.**",
                        ReportTemplateFormat      = TemplateFormat.Markdown,
                        SmtpUseSsl                = true,
                        UserName                  = System.Security.Principal.WindowsIdentity.GetCurrent().Name,
                        RegionInfo                = "Windsor",
                        ShowAssembliesTab         = false,
                        TopMost                   = true,
                    }
                };
                er.Show(args.Exception);
                er.Send();
            };
            AppDomain.CurrentDomain.UnhandledException += (sender, args) =>
            {
                log.Error(sender, (Exception)args.ExceptionObject);
                errorHandler.EmailExceptionAndActionLogToSupport(sender, (Exception)args.ExceptionObject);
                ExceptionReporter er = new ExceptionReporter
                {
                    Config =
                    {
                        AppName                   = "SPM Connect",
                        ShowFullDetail            = false,
                        CompanyName               = "SPM Automation",
                        TitleText                 = "SPM Connect Error Report",
                        EmailReportAddress        = "*****@*****.**",
                        TakeScreenshot            = true,                  // attached if sending email
                        SendMethod                = ReportSendMethod.SMTP, // also WebService/SimpleMAPI
                        SmtpServer                = "spmautomation-com0i.mail.protection.outlook.com",
                        SmtpPort                  =                                                          25,
                        SmtpUseDefaultCredentials = true,
                        SmtpFromAddress           = "*****@*****.**",
                        ReportTemplateFormat      = TemplateFormat.Markdown,
                        SmtpUseSsl                = true,
                        UserName                  = System.Security.Principal.WindowsIdentity.GetCurrent().Name,
                        RegionInfo                = "Windsor",
                        ShowAssembliesTab         = false,
                        TopMost                   = true,
                    }
                };
                er.Show((Exception)args.ExceptionObject);
                er.Send();
            };

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new SPM_ConnectHome());
        }