/// <summary> /// The window will not be closed while the main event queue is running, /// and shutting down the main event queue will shut down the window as well. /// </summary> /// <param name="window">The <see cref="Window"/> to bind to the main event queue.</param> public static void BindWindowToAppLifeCycle(Window window) { if (window.NullReference()) { throw Exc.Null(nameof(window)); } var windowCloseHandler = new WindowCloseHandler(window); MainEventQueue.Subscribers.Add <ShutDownEvent>(windowCloseHandler, weakRef: false); // a strong ref. for the handler, but a weak ref. for the window }
public GUI_window(GUI_Base guiBase, Window window, WindowControlHandler controlHandler, WindowCloseHandler closeHandler) { GuiBase = guiBase; WindowRect = window.windowRect; TitleText = window.titleText; ControlHandler = new WindowControlHandler(controlHandler); CloseHandler = new WindowCloseHandler(closeHandler); _hasMoveable = window.hasMoveable; _hasMinimizeButton = window.hasMinimizeButton; _hasCloseButton = window.hasCloseButton; _hasToolTipButton = window.hasToolTipButton; _HasTimeInTitle = window.hasTimeInTitle; ID = window.windowID; Enabled = window.enabled; PreInitWindow(); }