public CaptureScreenToFile ( string filename, |
||
filename | string | |
format | ||
Результат | void |
/// <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(); }
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(); }
/// <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(); }