Index: Application/Application.Ringtoets/App.xaml.cs
===================================================================
diff -u -r8490de857fc360680dc71c559bc99e67db4cdcc0 -r6e97317a1cb4fc45ec0b40073489ef60ef9ecae9
--- Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 8490de857fc360680dc71c559bc99e67db4cdcc0)
+++ Application/Application.Ringtoets/App.xaml.cs (.../App.xaml.cs) (revision 6e97317a1cb4fc45ec0b40073489ef60ef9ecae9)
@@ -280,26 +280,29 @@
private static void HandleException(Exception exception, bool isTerminating)
{
- var exceptionDialog = new ExceptionDialog(exception);
-
- exceptionDialog.OpenLogClicked = () =>
+ var mainWindow = gui.MainWindow as IWin32Window;
+ if (mainWindow != null)
{
- if (gui != null && gui.CommandHandler != null)
+ var exceptionDialog = new ExceptionDialog(mainWindow, exception)
{
- gui.CommandHandler.OpenLogFileExternal();
- }
- };
+ OpenLogClicked = () =>
+ {
+ if (gui.CommandHandler != null)
+ {
+ gui.CommandHandler.OpenLogFileExternal();
+ }
+ }
+ };
- gui.SkipDialogsOnExit = true;
+ if (exceptionDialog.ShowDialog() == DialogResult.OK)
+ {
+ Restart();
- if (exceptionDialog.ShowDialog() == DialogResult.OK)
- {
- Restart();
+ return;
+ }
}
- else
- {
- Environment.Exit(1);
- }
+
+ Environment.Exit(1);
}
private static void Restart()
Index: Core/Common/src/Core.Common.Controls/Dialogs/DialogBase.cs
===================================================================
diff -u -r934175819c7bf0bcee299dace068f8cb7604cc14 -r6e97317a1cb4fc45ec0b40073489ef60ef9ecae9
--- Core/Common/src/Core.Common.Controls/Dialogs/DialogBase.cs (.../DialogBase.cs) (revision 934175819c7bf0bcee299dace068f8cb7604cc14)
+++ Core/Common/src/Core.Common.Controls/Dialogs/DialogBase.cs (.../DialogBase.cs) (revision 6e97317a1cb4fc45ec0b40073489ef60ef9ecae9)
@@ -21,32 +21,36 @@
/// no maximize control box item is shown ( is set to false);
///
/// -
- /// the parent form is automatically obtained using .
+ /// the owning form is always set as provided during creation time.
///
///
///
public abstract partial class DialogBase : Form
{
+ private readonly IWin32Window owner;
+
///
/// Constructs a new .
///
+ /// The owner of the dialog.
/// The icon to show in the control box.
- protected DialogBase(Icon icon)
+ protected DialogBase(IWin32Window owner, Icon icon)
{
InitializeComponent();
+ this.owner = owner;
+
Icon = icon;
}
///
/// This method provides a new implementation of .
- /// In this new implementation the dialog is shown with an owner,
- /// which is automatically derived via .
+ /// In this new implementation the dialog is shown by passing the owner provided during creation time (.
///
/// A .
public new DialogResult ShowDialog()
{
- return base.ShowDialog(ModalHelper.MainWindow);
+ return base.ShowDialog(owner);
}
protected override void OnShown(EventArgs e)
Index: Core/Common/src/Core.Common.Controls/Dialogs/ExceptionDialog.cs
===================================================================
diff -u -r8490de857fc360680dc71c559bc99e67db4cdcc0 -r6e97317a1cb4fc45ec0b40073489ef60ef9ecae9
--- Core/Common/src/Core.Common.Controls/Dialogs/ExceptionDialog.cs (.../ExceptionDialog.cs) (revision 8490de857fc360680dc71c559bc99e67db4cdcc0)
+++ Core/Common/src/Core.Common.Controls/Dialogs/ExceptionDialog.cs (.../ExceptionDialog.cs) (revision 6e97317a1cb4fc45ec0b40073489ef60ef9ecae9)
@@ -25,8 +25,9 @@
///
/// Constructs a new .
///
+ /// The owner of the dialog.
/// The exception to show in the dialog.
- public ExceptionDialog(Exception exception) : base(Resources.bug__exclamation)
+ public ExceptionDialog(IWin32Window owner, Exception exception) : base(owner, Resources.bug__exclamation)
{
InitializeComponent();