Index: src/Common/DelftTools.Controls.Swf/ModalHelper.cs =================================================================== diff -u -r8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9 -r5fc71a385897af92ccb092f2f969b5709afab85a --- src/Common/DelftTools.Controls.Swf/ModalHelper.cs (.../ModalHelper.cs) (revision 8f6ae890fed8e8eae3a32f9c0498a10f82e0ddf9) +++ src/Common/DelftTools.Controls.Swf/ModalHelper.cs (.../ModalHelper.cs) (revision 5fc71a385897af92ccb092f2f969b5709afab85a) @@ -6,21 +6,29 @@ public static class ModalHelper { private static WeakReference mainWindowRef; + public static IWin32Window MainWindow { private get { if (mainWindowRef != null) + { return (IWin32Window) mainWindowRef.Target; + } return null; } - set { mainWindowRef = value != null ? new WeakReference(value) : null; } + set + { + mainWindowRef = value != null ? new WeakReference(value) : null; + } } public static DialogResult ShowModal(Form f) { if (MainWindow == null) + { throw new InvalidOperationException("Main window not injected"); + } return f.ShowDialog(MainWindow); }