Exemple #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            if (!System.Diagnostics.Debugger.IsAttached)
                AppDomain.CurrentDomain.UnhandledException += delegate(object sender, UnhandledExceptionEventArgs args)
                {
                    Exception ex = args.ExceptionObject as Exception;
                    var wnd = new ErrorWindow(ex);
                    wnd.ShowDialog();
                    ErrorLog.WriteError(ex, "Unhandled Exception main", false);
                    if (ErrorLog.CheckandUpload())
                        MessageBox.Show("Uploaded error log.");
                };
            AppDomain.CurrentDomain.ProcessExit += delegate(object sender, EventArgs ea)
            {
                if (ErrorLog.CheckandUpload())
                    MessageBox.Show("Uploaded error log.");
            };
            Updates.PerformHouskeeping();

            Program.GamesRepository = new Octgn.Data.GamesRepository();

            base.OnStartup(e);
        }
Exemple #2
0
 private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     var ex = (Exception) e.ExceptionObject;
     if (!Debugger.IsAttached)
     {
         var wnd = new ErrorWindow(ex);
         wnd.ShowDialog();
     }
     else
     {
         if (e.IsTerminating)
             Debugger.Break();
     }
     if (!e.IsTerminating)
         Program.DebugTrace.TraceEvent(TraceEventType.Error, 0, ex.ToString());
 }