Exemple #1
0
        /// <summary>
        /// Shows an info dialog with an extra button.
        /// </summary>
        /// <param name="title">Title of window</param>
        /// <param name="subject">Header text</param>
        /// <param name="fullText">Full paragraph text</param>
        /// <param name="extraButton">A Button object with the optional extra button.</param>
        /// <returns>A boolean showing whether the extra button was pressed or not.</returns>
        public static bool ShowInfoDialog(string title, string subject, string fullText, Button extraButton)
        {
            InfoDialog dialog = new InfoDialog();

            if (extraButton.IsEnabled)
            {
                dialog.ExtraButton.Content = extraButton.Text;
            }
            else
            {
                dialog.ExtraButton.Opacity   = 0;
                dialog.ExtraButton.IsEnabled = false;
            }
            dialog.Subject.Text          = subject;
            dialog.FullText.Text         = fullText;
            dialog.Title                 = title;
            dialog.Owner                 = Application.Current.MainWindow;
            dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            dialog.ShowDialog();
            if (dialog.FullText.Text == "ExtraButtonClicked")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// Shows an info dialog with an extra button.
        /// </summary>
        /// <param name="title">Title of window</param>
        /// <param name="subject">Header text</param>
        /// <param name="fullText">Full paragraph text</param>
        /// <param name="extraButton">A Button object with the optional extra button.</param>
        /// <returns>A boolean showing whether the extra button was pressed or not.</returns>
        public static bool ShowInfoDialog(string title, string subject, string fullText, Button extraButton)
        {
            InfoDialog dialog = new InfoDialog();

            if (extraButton.IsEnabled)
            {
                dialog.ExtraButton.Content = extraButton.Text;
            }
            else
            {
                dialog.ExtraButton.Opacity   = 0;
                dialog.ExtraButton.IsEnabled = false;
            }
            dialog.Subject.Text  = subject;
            dialog.FullText.Text = fullText;
            dialog.Title         = title;
            dialog.ShowDialog();
            if (dialog.FullText.Text == "ExtraButtonClicked")
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }