public App() { if (Current != null) { throw new ApplicationException("Application instance already exists"); } InitializeComponent(); SingletonViewModelLocator.RegisterFactory <ShellView, ShellViewModel>(); SingletonViewModelLocator.RegisterFactory <Overview, OverviewViewModel>(); SingletonViewModelLocator.RegisterFactory <Request, RequestViewModel>(); Application.Current.Dispatcher.UnhandledException += (sender, args) => { var ex = args.Exception; var ae = ex as AggregateException; Exception inner; if (ae != null && ae.TryUnwrap(out inner)) { ex = inner; } MessageBox.Show(ex.Message, "Error"); UncleanShutdown(); Application.Current.Shutdown(1); }; Application.Current.Startup += Application_Startup; Current = this; }
public App() { if (Current != null) { throw new ApplicationException("Application instance already exists"); } SingletonViewModelLocator.RegisterFactory <LauncherProgressView, LauncherProgressViewModel>(); Application.Current.Dispatcher.UnhandledException += (sender, args) => { var ex = args.Exception; MessageBox.Show(ex.Message, "Error"); UncleanShutdown(); Shutdown(1); }; Application.Current.Startup += Application_Startup; Current = this; }