Inheritance: System.Windows.Forms.Form
        /// <summary>
        /// Sends exception report directly to receiver email address provided in ToEmail.
        /// </summary>
        /// <param name="exception">Exception object that contains details of the exception.</param>
        public void Send(Exception exception)
        {
            Exception = exception;

            var    mainAssembly = Assembly.GetEntryAssembly();
            string appTitle     = null;
            var    attributes   = mainAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), true);

            if (attributes.Length > 0)
            {
                appTitle = ((AssemblyTitleAttribute)attributes[0]).Title;
            }
            ApplicationTitle   = !string.IsNullOrEmpty(appTitle) ? appTitle : mainAssembly.GetName().Name;
            ApplicationVersion = mainAssembly.GetName().Version.ToString();

            try
            {
                ScreenShot = $@"{Path.GetTempPath()}\{ApplicationTitle} Crash Screenshot.png";
                if (CaptureScreen)
                {
                    CaptureScreenshot.CaptureScreen(ScreenShot, ImageFormat.Png);
                }
                else
                {
                    CaptureScreenshot.CaptureActiveWindow(ScreenShot, ImageFormat.Png);
                }
            }
            catch (Exception e)
            {
                Debug.Write(e.Message);
            }
            if (String.IsNullOrEmpty(ToEmail) || !AnalyzeWithDoctorDump && (String.IsNullOrEmpty(FromEmail) || String.IsNullOrEmpty(SmtpHost)))
            {
                return;
            }

            if (!Application.MessageLoop)
            {
                Application.EnableVisualStyles();
            }
            CrashReport crashReport = new CrashReport(this);

            if (Thread.CurrentThread.GetApartmentState().Equals(ApartmentState.MTA))
            {
                var thread = new Thread(() => crashReport.ShowDialog())
                {
                    IsBackground = false
                };
                thread.CurrentCulture = thread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
                thread.Join();
            }
            else
            {
                crashReport.ShowDialog();
            }
        }
示例#2
0
        /// <summary>
        /// Sends exception report directly to receiver email address provided in ToEmail.
        /// </summary>
        /// <param name="exception">Exception object that contains details of the exception.</param>
        public void Send(Exception exception)
        {
            Exception = exception;

            var    mainAssembly = Assembly.GetEntryAssembly();
            string appTitle     = null;
            var    attributes   = mainAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), true);

            if (attributes.Length > 0)
            {
                appTitle = ((AssemblyTitleAttribute)attributes[0]).Title;
            }
            ApplicationTitle   = !string.IsNullOrEmpty(appTitle) ? appTitle : mainAssembly.GetName().Name;
            ApplicationVersion = mainAssembly.GetName().Version.ToString();

            try
            {
                var captureScreenshot = new CaptureScreenshot();
                ScreenShot = string.Format(@"{0}\{1} Crash Screenshot.png", Path.GetTempPath(),
                                           ApplicationTitle);
                captureScreenshot.CaptureScreenToFile(ScreenShot, ImageFormat.Png);
            }
            catch (Exception e)
            {
                Debug.Write(e.Message);
            }
            if (String.IsNullOrEmpty(FromEmail) || String.IsNullOrEmpty(ToEmail) || String.IsNullOrEmpty(SmtpHost))
            {
                return;
            }

            var crashReport = new CrashReport(this);

            var parameterizedThreadStart = new ParameterizedThreadStart(ShowUI);
            var thread = new Thread(parameterizedThreadStart)
            {
                IsBackground = false
            };

            thread.SetApartmentState(ApartmentState.STA);
            thread.Start(crashReport);
            thread.Join();
        }
示例#3
0
        public void Send(Exception exception)
        {
            try
            {
                var captureScreenshot = new CaptureScreenshot();
                captureScreenshot.CaptureScreenToFile(string.Format("{0}\\{1}CrashScreenshot.png", Path.GetTempPath(), System.Reflection.Assembly.GetEntryAssembly().GetName().Name), ImageFormat.Png);
            }
            catch
            {
            }
            if (String.IsNullOrEmpty(ToEmail))
            {
                return;
            }
            var toAddress = new MailAddress(ToEmail);

            var crashReport = new CrashReport(exception, toAddress);

            crashReport.ShowDialog();
        }
示例#4
0
 private static void ShowUI(object reportCrash)
 {
     var crashReport = new CrashReport((ReportCrash) reportCrash);
     crashReport.ShowDialog();
 }
示例#5
0
        /// <summary>
        /// Sends exception report directly to receiver email address provided in ToEmail.
        /// </summary>
        /// <param name="exception">Exception object that contains details of the exception.</param>
        public void Send(Exception exception)
        {
            Exception = exception;

            var mainAssembly = Assembly.GetEntryAssembly();
            string appTitle = null;
            var attributes = mainAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), true);
            if (attributes.Length > 0)
            {
                appTitle = ((AssemblyTitleAttribute) attributes[0]).Title;
            }
            ApplicationTitle = !string.IsNullOrEmpty(appTitle) ? appTitle : mainAssembly.GetName().Name;
            ApplicationVersion = mainAssembly.GetName().Version.ToString();

            try
            {
                var captureScreenshot = new CaptureScreenshot();
                ScreenShot = string.Format(@"{0}\{1} Crash Screenshot.png", Path.GetTempPath(),
                                           ApplicationTitle);
                captureScreenshot.CaptureScreenToFile(ScreenShot, ImageFormat.Png);
            }
            catch (Exception e)
            {
                Debug.Write(e.Message);
            }
            if (String.IsNullOrEmpty(FromEmail) || String.IsNullOrEmpty(ToEmail) || String.IsNullOrEmpty(SmtpHost))
                return;

            var crashReport = new CrashReport(this);

            var parameterizedThreadStart = new ParameterizedThreadStart(ShowUI);
            var thread = new Thread(parameterizedThreadStart) {IsBackground = false};
            thread.SetApartmentState(ApartmentState.STA);
            thread.Start(crashReport);
            thread.Join();
        }
示例#6
0
        private static void ShowUI(object reportCrash)
        {
            var crashReport = new CrashReport((ReportCrash)reportCrash);

            crashReport.ShowDialog();
        }