/// <summary>
 /// Displays a message box with the specified text and parameters.
 /// </summary>
 /// <param name="text">The text.</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>
 /// <param name="sound">The sound configuration</param>
 /// <returns>One of the <see cref="InformationBoxResult"/> values.</returns>
 public static InformationBoxResult Show(string text,
                                         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,
                                         InformationBoxSound sound = InformationBoxSound.Default)
 {
     return(new InformationBoxForm(text, 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, sound).Show());
 }
Пример #2
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">The <paramref name="obj"/> parameter is null.</exception>
        public override bool Equals(object obj)
        {
            if (obj == null || GetType() != obj.GetType())
            {
                return(false);
            }

            AutoCloseParameters compared = (AutoCloseParameters)obj;

            return(this.DefaultButton == compared.DefaultButton &&
                   this.Mode == compared.Mode &&
                   this.Result == compared.Result &&
                   this.Seconds == compared.Seconds);
        }
        /// <summary>
        /// Merges the specified parameters.
        /// </summary>
        /// <param name="parameters">The parameters.</param>
        /// <returns>The result of the merge operation </returns>
        public InformationBoxScopeParameters Merge(InformationBoxScopeParameters parameters)
        {
            if (parameters.Icon.HasValue && !this.Icon.HasValue)
            {
                this.icon = parameters.Icon.Value;
            }

            if (parameters.CustomIcon != null && null == this.CustomIcon)
            {
                this.customIcon = parameters.CustomIcon;
            }

            if (parameters.Buttons.HasValue && !this.Buttons.HasValue)
            {
                this.buttons = parameters.Buttons.Value;
            }

            if (parameters.DefaultButton.HasValue && !this.DefaultButton.HasValue)
            {
                this.defaultButton = parameters.DefaultButton.Value;
            }

            if (parameters.Layout.HasValue && !this.Layout.HasValue)
            {
                this.layout = parameters.Layout.Value;
            }

            if (parameters.AutoSizeMode.HasValue && !this.AutoSizeMode.HasValue)
            {
                this.autoSizeMode = parameters.AutoSizeMode.Value;
            }

            if (parameters.Position.HasValue && !this.Position.HasValue)
            {
                this.position = parameters.Position.Value;
            }

            if (parameters.CheckBox.HasValue && !this.CheckBox.HasValue)
            {
                this.checkbox = parameters.CheckBox.Value;
            }

            if (parameters.Style.HasValue && !this.Style.HasValue)
            {
                this.style = parameters.Style.Value;
            }

            if (parameters.AutoClose != null && null == this.AutoClose)
            {
                this.autoClose = parameters.AutoClose;
            }

            if (parameters.Design != null && null == this.Design)
            {
                this.design = parameters.Design;
            }

            if (parameters.TitleIconStyle.HasValue && !this.TitleIconStyle.HasValue)
            {
                this.titleIconStyle = parameters.TitleIconStyle.Value;
            }

            if (parameters.TitleIcon != null && null == this.TitleIcon)
            {
                this.titleIcon = parameters.TitleIcon;
            }

            if (parameters.Behavior.HasValue && !this.Behavior.HasValue)
            {
                this.behavior = parameters.Behavior.Value;
            }

            if (parameters.Opacity.HasValue && !this.Opacity.HasValue)
            {
                this.opacity = parameters.Opacity.Value;
            }

            if (parameters.Help.HasValue && !this.Help.HasValue)
            {
                this.help = parameters.Help.Value;
            }

            if (parameters.HelpNavigator.HasValue && !this.HelpNavigator.HasValue)
            {
                this.helpNavigator = parameters.HelpNavigator.Value;
            }

            if (parameters.Order.HasValue && !this.Order.HasValue)
            {
                this.order = parameters.Order.Value;
            }

            return(this);
        }