public static void Create(Exception ex) { var window = new ErrorWindow(ex); if (Global.MainWindow != null) { window.Owner = Global.MainWindow; window.WindowStartupLocation = WindowStartupLocation.CenterOwner; } else { window.WindowStartupLocation = WindowStartupLocation.CenterScreen; } window.ShowDialog(); throw ex; }
private void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e) { Exception exception = e.ExceptionObject as Exception; ErrorWindow error = new ErrorWindow(exception); if (this.IsVisible) { error.Owner = this; error.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner; } else { error.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen; } error.ShowDialog(); this.Close(); }