Sample Usage

To include the Exception Reporter within your application:
  1. Add a Reference to ExceptionReporter.dll to you project (or use Nuget)
  2. add a namespace reference to ExceptionReporting (ie "using ExceptionReporting")
  3. Add code to show the Exception Reporter (see Examples below)

Example 1 (Explicit exception)

 using ExceptionReporting;
 //...
 
 try {
    //... some code
 }
 catch (Exception exception) 
 {
     ExceptionReporter reporter = new ExceptionReporter();

     // optionally, read properties from app config file (this may deprecate soon)     
     reporter.ReadConfig();  
 
     // otherwise, set configuration via code
     reporter.Config.AppName = "PhotoFuzz";
     reporter.Config.CompanyName = "Fuzz Pty Ltd";
     reporter.Config.TitleText = "PhotoFuzz Error Report";
     reporter.Config.EmailReportAddress = "support@fuzz.com";
     reporter.Config.ShowSysInfoTab = false;   // all tabs are shown by default
     reporter.Config.ShowFlatButtons = true;   // this particular config is code-only
     reporter.Config.TakeScreenshot = true;   // attached if sending email
     reporter.Config.FilesToAttach = new[] { "c:/file.txt" }; // any other files to attach
     //.. various other config available
     reporter.Show(exception);
  }

Example 2 (WinForms unhandled exception)

 using ExceptionReporting;
 //...
 
 Application.ThreadException += new ThreadExceptionHandler().ApplicationThreadException;
 //...
 internal class ThreadExceptionHandler
 {   
     public void ApplicationThreadException(object sender, ThreadExceptionEventArgs e)
     {
         ExceptionReporter reporter = new ExceptionReporter();
         reporter.Show(e.Exception);
     }
 }

Last edited Jul 11, 2013 at 3:24 AM by PandaWood, version 9

Comments

No comments yet.