private static void SetWindowOptions(Window window, WPFMessageBoxOptions.WindowOptionsContainer options)
        {
            window.WindowStartupLocation = options.StartupLocation;
            if (window.Owner == null && options.StartupLocation == WindowStartupLocation.CenterOwner)
                window.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            if (window.WindowStartupLocation == WindowStartupLocation.Manual)
            {
                window.Left = options.Position.X;
                window.Top = options.Position.Y;
            }

            window.ResizeMode = options.ResizeMode;
            window.ShowInTaskbar = options.ShowInTaskbar;

            window.MinWidth = options.MinWidth;
            window.MaxWidth = options.MaxWidth;
            window.MinHeight = options.MinHeight;
            window.MaxHeight = options.MaxHeight;

            window.SizeToContent = SizeToContent.WidthAndHeight;
            window.SnapsToDevicePixels = true;
        }
        /// <summary>
        /// Displays a message box that has a message and that returns a result.
        /// </summary>
        /// <param name="owner">A System.Windows.Window that represents the owner window of the message box.</param>
        /// <param name="messageBoxText">A System.String that specifies the text to display.</param>
        /// <param name="caption">A System.String that specifies the title bar caption to display.</param>
        /// <param name="buttons">A DW.WPFToolkit.Controls.WPFMessageBoxButtons value that specifies which button or buttons to display.</param>
        /// <param name="icon">A DW.WPFToolkit.Controls.WPFMessageBoxImage value that specifies the icon to display.</param>
        /// <param name="defaultButton">A DW.WPFToolkit.Controls.WPFMessageBoxResult value that specifies the default result of the message box.</param>
        /// <param name="options">A DW.WPFToolkit.Controls.WPFMessageBoxOptions value object that specifies the options.</param>
        /// <returns>A DW.WPFToolkit.Controls.WPFMessageBoxResult value that specifies which message box button is clicked by the user.</returns>
        public static WPFMessageBoxResult Show(Window owner, string messageBoxText, string caption, WPFMessageBoxButtons buttons, WPFMessageBoxImage icon, WPFMessageBoxResult defaultButton, WPFMessageBoxOptions options)
        {
            if (options == null)
                throw new ArgumentNullException("options");
            
            var box = new WPFMessageBox
            {
                Owner = owner,
                Message = messageBoxText,
                Title = caption ?? string.Empty,
                Buttons = buttons,
                Image = icon,
                DefaultButton = defaultButton,
                Options = options
            };

            SetWindowOptions(box, options.WindowOptions);

            var dialogResult = box.ShowDialog();
            if (dialogResult != true)
            {
                if (buttons == WPFMessageBoxButtons.OK)
                    return WPFMessageBoxResult.OK;
                return WPFMessageBoxResult.Cancel;
            }
            return box.Result;
        }
        /// <summary>
        /// Displays a message box that has a message and that returns a result.
        /// </summary>
        /// <param name="owner">A System.Windows.Window that represents the owner window of the message box.</param>
        /// <param name="messageBoxText">A System.String that specifies the text to display.</param>
        /// <param name="caption">A System.String that specifies the title bar caption to display.</param>
        /// <param name="buttons">A DW.WPFToolkit.Controls.WPFMessageBoxButtons value that specifies which button or buttons to display.</param>
        /// <param name="icon">A DW.WPFToolkit.Controls.WPFMessageBoxImage value that specifies the icon to display.</param>
        /// <param name="defaultButton">A DW.WPFToolkit.Controls.WPFMessageBoxResult value that specifies the default result of the message box.</param>
        /// <param name="options">A DW.WPFToolkit.Controls.WPFMessageBoxOptions value object that specifies the options.</param>
        /// <returns>A DW.WPFToolkit.Controls.WPFMessageBoxResult value that specifies which message box button is clicked by the user.</returns>
        public static WPFMessageBoxResult Show(Window owner, string messageBoxText, string caption, WPFMessageBoxButtons buttons, WPFMessageBoxImage icon, WPFMessageBoxResult defaultButton, WPFMessageBoxOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException("options");
            }

            var box = new WPFMessageBox
            {
                Owner         = owner,
                Message       = messageBoxText,
                Title         = caption ?? string.Empty,
                Buttons       = buttons,
                Image         = icon,
                DefaultButton = defaultButton,
                Options       = options
            };

            SetWindowOptions(box, options.WindowOptions);

            var dialogResult = box.ShowDialog();

            if (dialogResult != true)
            {
                if (buttons == WPFMessageBoxButtons.OK)
                {
                    return(WPFMessageBoxResult.OK);
                }
                return(WPFMessageBoxResult.Cancel);
            }
            return(box.Result);
        }
 /// <summary>
 /// Displays a message box that has a message and that returns a result.
 /// </summary>
 /// <param name="messageBoxText">A System.String that specifies the text to display.</param>
 /// <param name="caption">A System.String that specifies the title bar caption to display.</param>
 /// <param name="buttons">A DW.WPFToolkit.Controls.WPFMessageBoxButtons value that specifies which button or buttons to display.</param>
 /// <param name="icon">A DW.WPFToolkit.Controls.WPFMessageBoxImage value that specifies the icon to display.</param>
 /// <param name="defaultButton">A DW.WPFToolkit.Controls.WPFMessageBoxResult value that specifies the default result of the message box.</param>
 /// <param name="options">A DW.WPFToolkit.Controls.WPFMessageBoxOptions value object that specifies the options.</param>
 /// <returns>A DW.WPFToolkit.Controls.WPFMessageBoxResult value that specifies which message box button is clicked by the user.</returns>
 public static WPFMessageBoxResult Show(string messageBoxText, string caption, WPFMessageBoxButtons buttons, WPFMessageBoxImage icon, WPFMessageBoxResult defaultButton, WPFMessageBoxOptions options)
 {
     return Show(null, messageBoxText, caption, buttons, icon, defaultButton, options);
 }
 /// <summary>
 /// Displays a message box that has a message and that returns a result.
 /// </summary>
 /// <param name="messageBoxText">A System.String that specifies the text to display.</param>
 /// <param name="caption">A System.String that specifies the title bar caption to display.</param>
 /// <param name="buttons">A DW.WPFToolkit.Controls.WPFMessageBoxButtons value that specifies which button or buttons to display.</param>
 /// <param name="icon">A DW.WPFToolkit.Controls.WPFMessageBoxImage value that specifies the icon to display.</param>
 /// <param name="defaultButton">A DW.WPFToolkit.Controls.WPFMessageBoxResult value that specifies the default result of the message box.</param>
 /// <param name="options">A DW.WPFToolkit.Controls.WPFMessageBoxOptions value object that specifies the options.</param>
 /// <returns>A DW.WPFToolkit.Controls.WPFMessageBoxResult value that specifies which message box button is clicked by the user.</returns>
 public static WPFMessageBoxResult Show(string messageBoxText, string caption, WPFMessageBoxButtons buttons, WPFMessageBoxImage icon, WPFMessageBoxResult defaultButton, WPFMessageBoxOptions options)
 {
     return(Show(null, messageBoxText, caption, buttons, icon, defaultButton, options));
 }