public static void ShowPopup(string title, string url, int width = 600, int height = 400, System.Action requestUpdate = null) { Execute.OnUIThreadAsync(() => { var helper = new ScriptingHelper(); var popup = new MOTDPopup(title, url, width, height, helper); helper.OnRequestClose += () => { popup.logger.Info("Page said it wants to close"); popup.Close(); }; helper.OnUpdateRequested += () => { popup.logger.Info("Form said it wants to update"); popup.Close(); }; //< close anyway even if requestUpdate provided if (requestUpdate != null) { helper.OnUpdateRequested += requestUpdate; } // fix: when main window is closed, but another window is still active, app would not turn off without this if (ShellViewModel.Instance.shellView.IsActive) { popup.Owner = ShellViewModel.Instance.shellView; } popup.Show(); }); }
public static void ShowPopup(string title, string url, object scriptingHelper, int width = 600, int height = 400) { Execute.OnUIThreadAsync(() => { var popup = new MOTDPopup(title, url, width, height, scriptingHelper); // fix: when main window is closed, but another window is still active, app would not turn off without this if (ShellViewModel.Instance.shellView.IsActive) { popup.Owner = ShellViewModel.Instance.shellView; } popup.Show(); }); }