Exemple #1
0
        /// <summary>
        /// Shows a StackHashMessageBox and returns the result
        /// </summary>
        /// <param name="owner">Window that owns the message box</param>
        /// <param name="message">The message</param>
        /// <param name="caption">The caption</param>
        /// <param name="type">The type of message box to display</param>
        /// <param name="icon">The icon to display</param>
        /// <param name="ex">Exception associated with this message</param>
        /// <param name="serviceError">Service error associates with this message (NoError if none)</param>
        /// <returns>The result of the messsage box</returns>
        public static StackHashDialogResult Show(Window owner,
                                                 string message,
                                                 string caption,
                                                 StackHashMessageBoxType type,
                                                 StackHashMessageBoxIcon icon,
                                                 Exception ex,
                                                 StackHashServiceErrorCode serviceError)
        {
            bool unused;

            return(Show(owner, message, caption, type, icon, ex, serviceError, false, out unused));
        }
Exemple #2
0
        private StackHashMessageBox(string message, string caption, StackHashMessageBoxType type, StackHashMessageBoxIcon icon, Exception ex, StackHashServiceErrorCode serviceError, bool showDontShow)
        {
            InitializeComponent();

            _message      = message;
            _caption      = caption;
            _type         = type;
            _icon         = icon;
            _exception    = ex;
            _serviceError = serviceError;
            _showDontShow = showDontShow;

            // default to cancel unless we explictly set a different return value
            this.StackHashDialogResult = StackHashDialogResult.Cancel;
        }
Exemple #3
0
        /// <summary>
        /// Shows a StackHashMessageBox and returns the result
        /// </summary>
        /// <param name="owner">Window that owns the message box</param>
        /// <param name="message">The message</param>
        /// <param name="caption">The caption</param>
        /// <param name="type">The type of message box to display</param>
        /// <param name="icon">The icon to display</param>
        /// <param name="ex">Exception associated with this message</param>
        /// <param name="serviceError">Service error associates with this message (NoError if none)</param>
        /// <param name="showDontShow">Show the don't show this message again checkbox</param>
        /// <param name="dontShow">Returns the value of the don't show this message again checkbox</param>
        /// <returns>The result of the messsage box</returns>
        public static StackHashDialogResult Show(Window owner,
                                                 string message,
                                                 string caption,
                                                 StackHashMessageBoxType type,
                                                 StackHashMessageBoxIcon icon,
                                                 Exception ex,
                                                 StackHashServiceErrorCode serviceError,
                                                 bool showDontShow,
                                                 out bool dontShow)
        {
            // ok for owner and ex to be null
            if (string.IsNullOrEmpty(message))
            {
                throw new ArgumentException("message cannot be null or an empty string");
            }
            if (string.IsNullOrEmpty(caption))
            {
                throw new ArgumentException("caption cannot be null or an empty string");
            }

            StackHashMessageBox stackHashMessageBox = new StackHashMessageBox(message, caption, type, icon, ex, serviceError, showDontShow);

            // if no owner try the main window
            if (owner == null)
            {
                if (Application.Current != null)
                {
                    if (Application.Current.MainWindow != stackHashMessageBox)
                    {
                        owner = Application.Current.MainWindow;
                    }
                }
            }

            // if still no owner
            if (owner == null)
            {
                stackHashMessageBox.ShowInTaskbar         = true;
                stackHashMessageBox.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            }

            stackHashMessageBox.Owner = owner;
            stackHashMessageBox.ShowDialog();

            dontShow = stackHashMessageBox.DontShowAgain;

            return(stackHashMessageBox.StackHashDialogResult);
        }
Exemple #4
0
 /// <summary>
 /// Shows a StackHashMessageBox and returns the result
 /// </summary>
 /// <param name="owner">Window that owns the message box</param>
 /// <param name="message">The message</param>
 /// <param name="caption">The caption</param>
 /// <param name="type">The type of message box to display</param>
 /// <param name="icon">The icon to display</param>
 /// <param name="showDontShow">Show the don't show this message again checkbox</param>
 /// <param name="dontShow">Returns the value of the don't show this message again checkbox</param>
 /// <returns>The result of the messsage box</returns>
 public static StackHashDialogResult Show(Window owner, string message, string caption, StackHashMessageBoxType type, StackHashMessageBoxIcon icon, bool showDontShow, out bool dontShow)
 {
     return(Show(owner, message, caption, type, icon, null, StackHashServiceErrorCode.NoError, showDontShow, out dontShow));
 }