1/* 2 * Copyright (c) 2011, ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10using System; 11using System.Collections.Generic; 12using System.Configuration; 13using System.Data; 14using System.Linq; 15using System.Windows; 16 17namespace Aquarium 18{ 19 /// <summary> 20 /// Interaction logic for App.xaml 21 /// </summary> 22 public partial class App : Application 23 { 24 public App() 25 : base() 26 { 27 if (!System.Diagnostics.Debugger.IsAttached) 28 this.DispatcherUnhandledException += 29 new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException); 30 31 this.Startup += new StartupEventHandler(App_Startup); 32 } 33 34 public string[] CommandLineArguments; 35 36 void App_Startup(object sender, StartupEventArgs e) 37 { 38 this.CommandLineArguments = e.Args; 39 } 40 41 void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) 42 { 43 Exception ex = e.Exception; 44 MessageBox.Show(ex.ToString(), "Application Unhandled Exception", 45 MessageBoxButton.OK, MessageBoxImage.Error); 46 this.Shutdown(255); 47 e.Handled = true; 48 } 49 } 50} 51