public static void AddAndInitializeWithControl(WindowManager wm, XNAControl control)
        {
            var dp = new DarkeningPanel(wm);

            wm.AddAndInitializeControl(dp);
            dp.AddChild(control);
        }
Example #2
0
        /// <summary>
        /// Creates and displays a new message box with the specified caption and description.
        /// </summary>
        /// <param name="game">The game.</param>
        /// <param name="caption">The caption/header of the message box.</param>
        /// <param name="description">The description of the message box.</param>
        public static void Show(WindowManager windowManager, string caption, string description)
        {
            var panel = new DarkeningPanel(windowManager);

            panel.Focused = true;
            windowManager.AddAndInitializeControl(panel);

            var msgBox = new XNAMessageBox(windowManager,
                                           Renderer.GetSafeString(caption, 1),
                                           Renderer.GetSafeString(description, 0),
                                           XNAMessageBoxButtons.OK);

            panel.AddChild(msgBox);
            msgBox.OKClickedAction = MsgBox_OKClicked;
            windowManager.AddAndInitializeControl(msgBox);
        }
        /// <summary>
        /// Shows a message box with "Yes" and "No" being the user input options.
        /// </summary>
        /// <param name="windowManager">The WindowManager.</param>
        /// <param name="caption">The caption of the message box.</param>
        /// <param name="description">The description in the message box.</param>
        /// <returns>The XNAMessageBox instance that is created.</returns>
        public static XNAMessageBox ShowYesNoDialog(WindowManager windowManager, string caption, string description)
        {
            var panel = new DarkeningPanel(windowManager);

            windowManager.AddAndInitializeControl(panel);

            var msgBox = new XNAMessageBox(windowManager,
                                           Renderer.GetSafeString(caption, 1),
                                           Renderer.GetSafeString(description, 0),
                                           XNAMessageBoxButtons.YesNo);

            panel.AddChild(msgBox);
            msgBox.YesClickedAction = MsgBox_YesClicked;
            msgBox.NoClickedAction  = MsgBox_NoClicked;

            return(msgBox);
        }
 public void Show()
 {
     DarkeningPanel.AddAndInitializeWithControl(WindowManager, this);
 }