/// <summary> /// This method opens a new ExceptionWindow with the /// passed exception object as datacontext. /// </summary> public override void OnUnhandledException(Exception ex, bool terminate) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { var exceptionWindow = new ExceptionWindow(); var logService = ((App)App.Current).GetLogService(); var vm = new ExceptionWindowViewModel(logService, ex, terminate); vm.OnRequestClose += (s, e) => exceptionWindow.Close(); exceptionWindow.DataContext = vm; exceptionWindow.ShowDialog(App.Current.MainWindow); })); }