public void Show() { if (Dispatcher.CurrentDispatcher.Thread.IsBackground) { Dispatcher.CurrentDispatcher.Invoke(Show); return; } var dialog = _factory.CreateImportCsvFileDialog(); dialog.DataContext = _viewModel; dialog.Owner = _application.GetMainWindow(); dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner; dialog.ShowDialog(); }