コード例 #1
0
        /// <summary>
        /// Shows the box.
        /// </summary>
        /// <param name="behavior">The behavior.</param>
        private void ShowBox(InformationBoxBehavior behavior)
        {
            InformationBoxButtons buttons             = this.GetButtons();
            InformationBoxIcon    icon                = this.GetIcon();
            string iconFileName                       = this.txbIcon.Text;
            InformationBoxDefaultButton defaultButton = this.GetDefaultButton();
            InformationBoxButtonsLayout buttonsLayout = this.GetButtonsLayout();
            InformationBoxAutoSizeMode  autoSize      = this.GetAutoSize();
            InformationBoxPosition      position      = this.GetPosition();
            HelpNavigator                navigator    = this.GetHelpNavigator();
            InformationBoxCheckBox       checkState   = this.GetCheckBoxState();
            CheckState                   state        = 0;
            InformationBoxStyle          style        = this.GetStyle();
            AutoCloseParameters          autoClose    = this.GetAutoClose();
            DesignParameters             design       = this.GetDesign();
            InformationBoxTitleIconStyle titleStyle   = this.GetTitleStyle();
            InformationBoxOpacity        opacity      = this.GetOpacity();
            InformationBoxOrder          order        = this.GetOrder();
            InformationBoxSound          sound        = this.GetSound();

            InformationBoxTitleIcon titleIcon = null;

            if (titleStyle == InformationBoxTitleIconStyle.Custom)
            {
                titleIcon = new InformationBoxTitleIcon(this.txbTitleIconFile.Text);
            }

            if (String.IsNullOrEmpty(iconFileName))
            {
                InformationBox.Show(this.txbText.Text, out state, this.txbTitle.Text, buttons, new string[] { this.txbUser1.Text, this.txbUser2.Text, this.txbUser3.Text }, icon, defaultButton, buttonsLayout, autoSize, position, this.chbHelpButton.Checked, this.txbHelpFile.Text, navigator, this.txbHelpTopic.Text, checkState, style, autoClose, design, titleStyle, titleIcon, behavior, new AsyncResultCallback(BoxClosed), opacity, order, sound);
            }
            else
            {
                InformationBox.Show(this.txbText.Text, out state, this.txbTitle.Text, buttons, new string[] { this.txbUser1.Text, this.txbUser2.Text, this.txbUser3.Text }, new Icon(iconFileName), defaultButton, buttonsLayout, autoSize, position, this.chbHelpButton.Checked, this.txbHelpFile.Text, navigator, this.txbHelpTopic.Text, checkState, style, autoClose, design, titleStyle, titleIcon, behavior, new AsyncResultCallback(BoxClosed), opacity, order, sound);
            }

            if (checkState != 0)
            {
                InformationBox.Show(
                    String.Format(CultureInfo.InvariantCulture, "The state of the checkbox was {0}", state),
                    InformationBoxIcon.Information);
            }
        }
コード例 #2
0
        /// <summary>
        /// Displays a message box with the specified text and parameters.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="checkBoxState">The final value of the "Do not show this dialog again" checkbox.</param>
        /// <param name="title">The title.</param>
        /// <param name="helpFile">The help file.</param>
        /// <param name="helpTopic">The help topic.</param>
        /// <param name="initialization">The initialization.</param>
        /// <param name="buttons">The buttons.</param>
        /// <param name="icon">The icon.</param>
        /// <param name="customIcon">The custom icon.</param>
        /// <param name="defaultButton">The default button.</param>
        /// <param name="customButtons">The custom buttons.</param>
        /// <param name="buttonsLayout">The buttons layout.</param>
        /// <param name="autoSizeMode">The auto size mode.</param>
        /// <param name="position">The position.</param>
        /// <param name="showHelpButton">if set to <c>true</c> shows help button.</param>
        /// <param name="helpNavigator">The help navigator.</param>
        /// <param name="showDoNotShowAgainCheckBox">if set to <c>true</c> shows the do not show again check box.</param>
        /// <param name="style">The style.</param>
        /// <param name="autoClose">The auto close configuration.</param>
        /// <param name="design">The design.</param>
        /// <param name="titleStyle">The title style.</param>
        /// <param name="titleIcon">The title icon.</param>
        /// <param name="legacyButtons">The legacy buttons.</param>
        /// <param name="legacyIcon">The legacy icon.</param>
        /// <param name="legacyDefaultButton">The legacy default button.</param>
        /// <param name="behavior">The behavior.</param>
        /// <param name="callback">The callback.</param>
        /// <param name="opacity">The opacity.</param>
        /// <param name="parent">The parent form.</param>
        /// <param name="order">The z-order</param>
        /// <returns>
        /// One of the <see cref="InformationBoxResult"/> values.
        /// </returns>
        public static InformationBoxResult Show(string text,
                                                out CheckState checkBoxState,
                                                string title     = "",
                                                string helpFile  = "",
                                                string helpTopic = "",
                                                InformationBoxInitialization initialization = InformationBoxInitialization.FromScopeAndParameters,
                                                InformationBoxButtons buttons = InformationBoxButtons.OK,
                                                InformationBoxIcon icon       = InformationBoxIcon.None,
                                                Icon customIcon = null,
                                                InformationBoxDefaultButton defaultButton = InformationBoxDefaultButton.Button1,
                                                string[] customButtons = null,
                                                InformationBoxButtonsLayout buttonsLayout = InformationBoxButtonsLayout.GroupMiddle,
                                                InformationBoxAutoSizeMode autoSizeMode   = InformationBoxAutoSizeMode.None,
                                                InformationBoxPosition position           = InformationBoxPosition.CenterOnParent,
                                                bool showHelpButton         = false,
                                                HelpNavigator helpNavigator = HelpNavigator.TableOfContents,
                                                InformationBoxCheckBox showDoNotShowAgainCheckBox = 0,
                                                InformationBoxStyle style                   = InformationBoxStyle.Standard,
                                                AutoCloseParameters autoClose               = null,
                                                DesignParameters design                     = null,
                                                InformationBoxTitleIconStyle titleStyle     = InformationBoxTitleIconStyle.None,
                                                InformationBoxTitleIcon titleIcon           = null,
                                                MessageBoxButtons?legacyButtons             = null,
                                                MessageBoxIcon?legacyIcon                   = null,
                                                MessageBoxDefaultButton?legacyDefaultButton = null,
                                                InformationBoxBehavior behavior             = InformationBoxBehavior.Modal,
                                                AsyncResultCallback callback                = null,
                                                InformationBoxOpacity opacity               = InformationBoxOpacity.NoFade,
                                                Form parent = null,
                                                InformationBoxOrder order = InformationBoxOrder.Default)
        {
            var parameters = new object[] { title, helpFile, helpTopic, initialization, buttons, icon, customIcon, defaultButton,
                                            customButtons, buttonsLayout, autoSizeMode, position, showHelpButton, helpNavigator, showDoNotShowAgainCheckBox,
                                            style, autoClose, design, titleStyle, titleIcon, legacyButtons, legacyIcon, legacyDefaultButton, behavior, callback, opacity, parent, order };

            return(new InformationBoxStandardForm(text, parameters).Show(out checkBoxState));
        }