/// <summary>
        /// Displays a message box that has a message, title bar caption, button, and icon;
        /// and returns a result.
        /// </summary>
        /// <param name="messageBoxText">A <see cref="string"/> that specifies the text to display.</param>
        /// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
        /// <param name="button">A <see cref="BlurryDialogButton"/> value that specifies which button or buttons to display.</param>
        /// <param name="icon">A <see cref="BlurryDialogIcon"/> value that specifies the icon to display.</param>
        /// <param name="strength"> Determines the opacity of the window which is set to 0.75 by default and may not exceed 1</param>
        /// <returns>A <see cref="BlurryDialogResult"/> value that specifies which message box button is clicked by the user.</returns>
        public static BlurryDialogResult Show(string messageBoxText, string caption, BlurryDialogButton button, BlurryDialogIcon icon, double strength = Strength)
        {
            var result = BlurryDialogResult.None;
            var dialog = new BlurBehindDialogWindow
            {
                Title          = caption,
                DialogIcon     = icon,
                DialogMessage  = messageBoxText,
                Button         = button,
                Owner          = Application.Current.MainWindow,
                Strength       = strength,
                BlurDuration   = BlurDuration,
                UnblurDuration = UnblurDuration,
                BlurRadius     = BlurRadius
            };

            dialog.ResultAquired += (sender, args) =>
            {
                dialog.Close();
                result = args.Result;
            };

            dialog.ShowDialog();

            return(result);
        }
Esempio n. 2
0
        /// <summary>
        /// sets the visibility of the buttons in ButtonGrid by a preset combination
        /// provided by the <see cref="Button"/> property
        /// </summary>
        /// <param name="value">a chosen value of enum <see cref="BlurryDialogButton"/></param>
        private void SetButtonSet(BlurryDialogButton value)
        {
            switch (value)
            {
            case BlurryDialogButton.Ok:
                OkButton.Visibility = Visibility.Visible;

                YesButton.Visibility    = Visibility.Collapsed;
                NoButton.Visibility     = Visibility.Collapsed;
                CancelButton.Visibility = Visibility.Collapsed;
                break;

            case BlurryDialogButton.OkCancel:
                OkButton.Visibility     = Visibility.Visible;
                CancelButton.Visibility = Visibility.Visible;

                YesButton.Visibility = Visibility.Collapsed;
                NoButton.Visibility  = Visibility.Collapsed;
                break;

            case BlurryDialogButton.YesNo:
                YesButton.Visibility = Visibility.Visible;
                NoButton.Visibility  = Visibility.Visible;

                OkButton.Visibility     = Visibility.Collapsed;
                CancelButton.Visibility = Visibility.Collapsed;
                break;

            case BlurryDialogButton.YesNoCancel:
                YesButton.Visibility    = Visibility.Visible;
                NoButton.Visibility     = Visibility.Visible;
                CancelButton.Visibility = Visibility.Visible;

                OkButton.Visibility = Visibility.Collapsed;
                break;

            case BlurryDialogButton.None:
                OkButton.Visibility     = Visibility.Collapsed;
                YesButton.Visibility    = Visibility.Collapsed;
                NoButton.Visibility     = Visibility.Collapsed;
                CancelButton.Visibility = Visibility.Collapsed;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(value), value, null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Displays a message box that has a message, title bar caption, button, and icon;
        /// and returns a result.
        /// </summary>
        /// <param name="messageBoxText">A <see cref="string"/> that specifies the text to display.</param>
        /// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
        /// <param name="button">A <see cref="BlurryDialogButton"/> value that specifies which button or buttons to display.</param>
        /// <param name="icon">A <see cref="BlurryDialogIcon"/> value that specifies the icon to display.</param>
        /// <param name="strength"> Determines the opacity of the window which is set to 0.75 by default and may not exceed 1</param>
        /// <returns>A <see cref="BlurryDialogResult"/> value that specifies which message box button is clicked by the user.</returns>
        public static BlurryDialogResult Show(string messageBoxText, string caption, BlurryDialogButton button, BlurryDialogIcon icon, double?strength = null)
        {
            var result = BlurryDialogResult.None;
            var dialog = new BlurryDialogWindow
            {
                Title         = caption,
                DialogIcon    = icon,
                DialogMessage = messageBoxText,
                Button        = button,
                Owner         = null,
                Strength      = strength ?? ColorHelper.GetStrength()
            };

            dialog.ResultAquired += (sender, args) =>
            {
                dialog.Close();
                result = args.Result;
            };

            dialog.ShowDialog();

            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// Displays a message box in front of the specified window. The message box displays
        /// a message; and returns a result.
        /// </summary>
        /// <param name="owner">A <see cref="Window"/> that represents the owner window of the message box.</param>
        /// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
        /// <param name="content">A <see cref="FrameworkElement"/> that specifies the content to display.</param>
        /// <param name="button">A <see cref="BlurryDialogButton"/> value that specifies which button or buttons to display.</param>
        /// <param name="strength"> Determines the opacity of the window which is set to 0.75 by default and may not exceed 1</param>
        /// <returns>A <see cref="BlurryDialogResult"/> value that specifies which message box button is clicked by the user.</returns>
        public static BlurryDialogResult Show(Window owner, string caption, FrameworkElement content, BlurryDialogButton button, double?strength = null)
        {
            var result = BlurryDialogResult.None;
            var dialog = new BlurryDialogWindow
            {
                Title         = caption,
                DialogIcon    = BlurryDialogIcon.None,
                CustomContent = content,
                Button        = button,
                Owner         = owner,
                Strength      = strength ?? ColorHelper.GetStrength(owner)
            };

            dialog.ResultAquired += (sender, args) =>
            {
                dialog.Close();
                result = args.Result;
            };

            dialog.ShowDialog();

            return(result);
        }
        /// <summary>
        /// Displays a message box in front of the specified window. The message box displays
        /// a message; and returns a result.
        /// </summary>
        /// <param name="owner">A <see cref="Window"/> that represents the owner window of the message box.</param>
        /// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
        /// <param name="content">A <see cref="FrameworkElement"/> that specifies the content to display.</param>
        /// <param name="button">A <see cref="BlurryDialogButton"/> value that specifies which button or buttons to display.</param>
        /// <param name="strength"> Determines the opacity of the window which is set to 0.75 by default and may not exceed 1</param>
        /// <returns>A <see cref="BlurryDialogResult"/> value that specifies which message box button is clicked by the user.</returns>
        public static BlurryDialogResult Show(Window owner, string caption, FrameworkElement content, BlurryDialogButton button, double strength = Strength)
        {
            var result = BlurryDialogResult.None;
            var dialog = new BlurBehindDialogWindow
            {
                Title          = caption,
                DialogIcon     = BlurryDialogIcon.None,
                CustomContent  = content,
                Button         = button,
                Owner          = owner,
                Strength       = strength,
                BlurDuration   = BlurDuration,
                UnblurDuration = UnblurDuration,
                BlurRadius     = BlurRadius
            };

            dialog.ResultAquired += (sender, args) =>
            {
                dialog.Close();
                result = args.Result;
            };

            dialog.ShowDialog();

            return(result);
        }
Esempio n. 6
0
        /// <summary>
        /// Displays a message box in front of the specified window. The message box displays
        /// a message, title bar caption, button, and icon; and returns a result.
        /// </summary>
        /// <param name="owner">A <see cref="Window"/> that represents the owner window of the message box.</param>
        /// <param name="messageBoxText">A <see cref="string"/> that specifies the text to display.</param>
        /// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
        /// <param name="button">A <see cref="BlurryDialogButton"/> value that specifies which button or buttons to display.</param>
        /// <param name="icon">A <see cref="BlurryDialogIcon"/> value that specifies the icon to display.</param>
        /// <param name="strength"> Determines the opacity of the window which is set to 0.75 by default and may not exceed 1</param>
        /// <returns>A <see cref="BlurryDialogResult"/> value that specifies which message box button is clicked by the user.</returns>
        public static BlurryDialogResult Show(Window owner, string messageBoxText, string caption, BlurryDialogButton button, BlurryDialogIcon icon, double strength = Strength)
        {
            var result = BlurryDialogResult.None;
            var dialog = new BlurryDialogWindow()
            {
                Title         = caption,
                DialogIcon    = icon,
                DialogMessage = messageBoxText,
                Button        = button,
                Owner         = owner,
                Strength      = strength
            };

            dialog.ResultAquired += (sender, args) =>
            {
                dialog.Close();
                result = args.Result;
            };

            dialog.ShowDialog();

            return(result);
        }
        /// <summary>
        /// Displays a message box in front of the specified window. The message box displays
        /// a message; and returns a result.
        /// </summary>
        /// <param name="caption">A <see cref="string"/> that specifies the title bar caption to display.</param>
        /// <param name="content">A <see cref="FrameworkElement"/> that specifies the content to display.</param>
        /// <param name="button">A <see cref="BlurryDialogButton"/> value that specifies which button or buttons to display.</param>
        /// <param name="strength"> Determines the opacity of the window which is set to 0.75 by default and may not exceed 1</param>
        /// <returns>A <see cref="BlurryDialogResult"/> value that specifies which message box button is clicked by the user.</returns>
        public static BlurryDialogResult Show(string caption, FrameworkElement content, BlurryDialogButton button, double?strength = null)
        {
            var result = BlurryDialogResult.None;
            var dialog = new BlurBehindDialogWindow
            {
                Title          = caption,
                DialogIcon     = BlurryDialogIcon.None,
                CustomContent  = content,
                Button         = button,
                Owner          = Application.Current.MainWindow,
                Strength       = strength ?? ColorHelper.GetStrength(),
                BlurDuration   = BlurDuration,
                UnblurDuration = UnblurDuration,
                BlurRadius     = BlurRadius
            };

            dialog.ResultAquired += (sender, args) =>
            {
                dialog.Close();
                result = args.Result;
            };

            dialog.ShowDialog();

            return(result);
        }