Пример #1
0
        /// <summary>
        /// Show a message box and return result
        /// </summary>
        /// <param name="messageText"></param>
        /// <param name="titleCaption"></param>
        /// <param name="buttons"></param>
        /// <param name="icon"></param>
        /// <returns></returns>
        ///
        public static DialogResult Show(
            string messageText,
            string titleCaption,
            MessageBoxButtons buttons,
            MessageBoxIcon icon,
            int width  = -1,
            int height = -1)
        {
            DialogResult dr = DialogResult.OK;

            if (!Lex.IsNullOrEmpty(ScriptLog.FileName))
            {
                ScriptLog.Message("> " + messageText);
            }

            if (!SS.I.Attended)
            {
                ClientLog.Message("Show: " + messageText);
                return(DialogResult.OK);
            }

            else if (SS.I.QueryTestMode)
            {
                QueryTest.LogMessage("Show: " + messageText);
                return(DialogResult.OK);
            }

            //DebugLog.Message(messageText += "\r\n" + new StackTrace(true)); // debug where message is called from"

            Progress.Hide();                       // hide any progress message

            if (Lex.Contains(messageText, "<br>")) // replace "<br>" with newlines
            {
                messageText = messageText.Replace("<br>", "\r\n");
            }

            if (Lex.CountLines(messageText) > 5)
            {
                if (width <= 0)
                {
                    width = 650;
                }
                if (height <= 0)
                {
                    height = 400;
                }
                dr = ShowWithCustomSize(messageText, titleCaption, buttons, icon, width, height);
                return(dr);
            }

            if (messageText.Length > 72 && !messageText.Contains("\r") && !messageText.Contains("\n"))
            {
                messageText = WrapText(messageText, 6000);
            }
            //icon = MessageBoxIcon.Information;
            dr = XtraMessageBox.Show(messageText, titleCaption, buttons, icon);
            return(dr);
        }