Example #1
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += (sender, e) =>
            {
                DBZugriff.CloseDB();
            };


            DBZugriff.InitDB();


            RunTest();

            DBZugriff.CloseDB();

            Console.ReadKey();
        }
Example #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            AppDomain.CurrentDomain.UnhandledException += (sender, e2) =>
            {
                try
                {
                    DBZugriff.CloseDB();

                    Exception ex = e2.ExceptionObject as Exception;
                    if (ex != null)
                    {
                        this.Dispatcher.Invoke(() =>
                        {
                            CrashMessage.ShowErrorMessage(ex);
                        });
                    }
                    else
                    {
                        throw new Exception("Ungültige Exception von Sender: " + sender);
                    }
                }
                catch (Exception exx)
                {
                    MessageBox.Show(exx.ToString(), "Fatal", MessageBoxButton.OK, MessageBoxImage.Error);
                    Environment.Exit(-1);
                }
            };

            //Start EF
            DBZugriff.InitDB();

#if DEBUG
            //Testaufruf
            //Aufruf durch Projekt>Eigenschaften>Debugging>Parameter: -test (Danach aber wieder entfernen;)
            if (Environment.GetCommandLineArgs().Contains("-test"))
            {
                Test();
            }
#endif
        }
Example #3
0
 private void Application_Exit(object sender, ExitEventArgs e)
 {
     DBZugriff.CloseDB();
 }