Esempio n. 1
0
        /// <summary>
        /// Show Mobius system availability message
        /// </summary>
        /// <param name="messageText"></param>
        /// <param name="messageTitle"></param>
        /// <param name="icon"></param>

        public static void Show(
            string messageText,
            string messageTitle,
            MessageBoxIcon icon,
            Form parentForm)
        {
            if (!Lex.IsNullOrEmpty(ScriptLog.FileName))
            {
                ScriptLog.Message("> " + messageTitle + " - " + messageText);
            }

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

            bool error = (icon == MessageBoxIcon.Error);

            SystemAvailabilityMsg sam = new SystemAvailabilityMsg();

            sam.Text             = messageTitle;
            sam.SysAvailMsg.Text = messageText;
            MessageBoxMx.SetIconImageIndex(sam.IconImage, icon);

            if (!error && SS.I != null && SS.I.UserIniFile != null)
            {
                string dontShowMsg = SS.I.UserIniFile.Read("SystemAvailabilityMsgDontShowMsg");
                if (Lex.Eq(messageText, dontShowMsg))
                {
                    return;                                                   // if msg not to show just return
                }
                sam.DontShowAgainButton.Visible = true;
            }

            else
            {
                sam.DontShowAgainButton.Visible = false;             // hide for error
            }
            if (parentForm != null && parentForm.Visible)            // put in front of supplied form if any
            {
                sam.ShowDialog(parentForm);
            }

            else
            {
                sam.ShowDialog();
            }

            return;
        }