예제 #1
0
        /// <summary>
        /// ShowExceptionDialog
        /// Displays a message to the user
        /// </summary>
        /// <param name="message"></param>
        public static void ShowExceptionDialog(MessagePacket message)
        {
            ExceptionDialog exceptionDialog = new ExceptionDialog();

            exceptionDialog.Init(message);
            exceptionDialog.Topmost = true;
            exceptionDialog.Show();
        }
예제 #2
0
        /// <summary>
        /// ShowExceptionDialog
        /// Displays an error message to the user.
        /// </summary>
        /// <param name="summary">Short summary of the error.</param>
        /// <param name="detail">Detailed explanation of the error.</param>
        public static void ShowExceptionDialog(string summary, string detail)
        {
            if (summary == null || summary.Length == 0)
            {
                if (summary == null)
                {
                    summary = "null";
                }
                MessagePacket invalidMessage = new MessagePacket();
                invalidMessage.Title    = "Invalid Argument Exception.";
                invalidMessage.Summary  = "The {0} method was called with an invalid argument.";
                invalidMessage.Detail   = "The value [{0}] was passed in for the parameter [{1}].";
                invalidMessage.Severity = MessagePacket.ExceptionSeverity.Error;
                invalidMessage.AddSummaryParameter("ShowExceptionDialog");
                invalidMessage.AddDetailParameter(summary);
                invalidMessage.AddDetailParameter("summary");
                throw new Exceptions(invalidMessage);
            }
            if (detail == null || detail.Length == 0)
            {
                if (detail == null)
                {
                    detail = "null";
                }
                MessagePacket invalidMessage = new MessagePacket();
                invalidMessage.Title    = "Invalid Argument Exception.";
                invalidMessage.Summary  = "The {0} method was called with an invalid argument.";
                invalidMessage.Detail   = "The value [{0}] was passed in for the parameter [{1}].";
                invalidMessage.Severity = MessagePacket.ExceptionSeverity.Error;
                invalidMessage.AddSummaryParameter("ShowExceptionDialog");
                invalidMessage.AddDetailParameter(detail);
                invalidMessage.AddDetailParameter("detail");
                throw new Exceptions(invalidMessage);
            }
            ExceptionDialog exceptionDialog = new ExceptionDialog();

            exceptionDialog.Init(summary, detail);
            exceptionDialog.Show();
        }