/TimeSheetReporting/TimeSheetReporting/App.xaml.cs

# · C# · 46 lines · 36 code · 4 blank · 6 comment · 1 complexity · 8caf38f0872a673ba3160a4a8da91a93 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Net;
  5. using System.Windows;
  6. using System.Windows.Controls;
  7. using System.Windows.Documents;
  8. using System.Windows.Input;
  9. using System.Windows.Media;
  10. using System.Windows.Media.Animation;
  11. using System.Windows.Shapes;
  12. namespace TimeSheetReporting
  13. {
  14. public partial class App : Application
  15. {
  16. public App()
  17. {
  18. this.Startup += this.Application_Startup;
  19. this.UnhandledException += this.Application_UnhandledException;
  20. InitializeComponent();
  21. }
  22. private void Application_Startup(object sender, StartupEventArgs e)
  23. {
  24. this.RootVisual = new MainPage();
  25. }
  26. private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)
  27. {
  28. // If the app is running outside of the debugger then report the exception using
  29. // a ChildWindow control.
  30. if (!System.Diagnostics.Debugger.IsAttached)
  31. {
  32. // NOTE: This will allow the application to continue running after an exception has been thrown
  33. // but not handled.
  34. // For production applications this error handling should be replaced with something that will
  35. // report the error to the website and stop the application.
  36. e.Handled = true;
  37. ChildWindow errorWin = new ErrorWindow(e.ExceptionObject);
  38. errorWin.Show();
  39. }
  40. }
  41. }
  42. }