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