Exemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DW.WPFToolkit.Controls.WPFMessageBoxOptions" /> class.
        /// </summary>
        public WPFMessageBoxOptions()
        {
            WindowOptions = new WindowOptionsContainer();
            Styles = new StylesContainer();

            MessageCopyFormatter = new DefaultMessageCopyFormatter();
            Strings = new MessageBoxStrings();
            ShowHelpButton = false;
            HelpRequestCallback = null;
            ShowYesToAllButton = false;
            ShowNoToAllButton = false;
            ShowDoNotShowAgainCheckBox = false;
            IsDoNotShowAgainChecked = false;
            ShowDetails = false;
            DetailsContent = null;
            CustomItem = null;
            BackgroundControl = null;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DW.WPFToolkit.Controls.WPFMessageBoxOptions" /> class.
        /// </summary>
        public WPFMessageBoxOptions()
        {
            WindowOptions = new WindowOptionsContainer();
            Styles        = new StylesContainer();

            MessageCopyFormatter = new DefaultMessageCopyFormatter();
            Strings                    = new MessageBoxStrings();
            ShowHelpButton             = false;
            HelpRequestCallback        = null;
            ShowYesToAllButton         = false;
            ShowNoToAllButton          = false;
            ShowDoNotShowAgainCheckBox = false;
            IsDoNotShowAgainChecked    = false;
            ShowDetails                = false;
            DetailsContent             = null;
            CustomItem                 = null;
            BackgroundControl          = null;
        }
        private void AppendButtons(StringBuilder builder, WPFMessageBoxButtons buttons, MessageBoxStrings strings)
        {
            switch (buttons)
            {
            case WPFMessageBoxButtons.OK:
                builder.AppendLine(string.Format("{0}   ", GetString(strings.OK)));
                break;

            case WPFMessageBoxButtons.OKCancel:
                builder.AppendLine(string.Format("{0}   {1}   ", GetString(strings.OK), GetString(strings.Cancel)));
                break;

            case WPFMessageBoxButtons.RetryCancel:
                builder.AppendLine(string.Format("{0}   {1}   ", GetString(strings.Retry), GetString(strings.Cancel)));
                break;

            case WPFMessageBoxButtons.YesNo:
                builder.AppendLine(string.Format("{0}   {1}   ", GetString(strings.Yes), GetString(strings.No)));
                break;

            case WPFMessageBoxButtons.YesNoCancel:
                builder.AppendLine(string.Format("{0}   {1}   {2}   ", GetString(strings.Yes), GetString(strings.No), GetString(strings.Cancel)));
                break;

            case WPFMessageBoxButtons.AbortRetryIgnore:
                builder.AppendLine(string.Format("{0}   {1}   {2}   ", GetString(strings.Abort), GetString(strings.Retry), GetString(strings.Ignore)));
                break;
            }
        }
        /// <summary>
        /// Called to copy the WPFMessageBox content somewhere to.
        /// </summary>
        /// <param name="title">The WPFMessageBox title.</param>
        /// <param name="message">The message shown in the WPFMessageBox.</param>
        /// <param name="buttons">The buttons available in the WPFMessageBox.</param>
        /// <param name="icon">The icon shown in the WPFMessageBox.</param>
        /// <param name="strings">The strings used in the WPFMessageBox.</param>
        public void Copy(string title, string message, WPFMessageBoxButtons buttons, WPFMessageBoxImage icon, MessageBoxStrings strings)
        {
            var builder = new StringBuilder();

            builder.AppendLine("---------------------------");
            builder.AppendLine(title);
            builder.AppendLine("---------------------------");
            builder.AppendLine(message);
            builder.AppendLine("---------------------------");
            AppendButtons(builder, buttons, strings);
            builder.AppendLine("---------------------------");

            Clipboard.SetText(builder.ToString());
        }