コード例 #1
0
ファイル: Output.cs プロジェクト: uvbs/babbot
        /// <summary>
        /// Displays a message box with the specified message, and message type.
        /// This is basically MessageBox.Show with a default OK button, and Icon/Sound.
        /// This method is more-or-less to keep the CLR happy.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="messageType">Type of the message.</param>
        internal DialogResult MsgBox(string message, OBMessageBoxType messageType)
        {
            if (String.IsNullOrEmpty(message))
            {
                throw new ArgumentException("Invalid message passed. Cannot display message box!", "message");
            }
            switch (messageType)
            {
            case OBMessageBoxType.Error:
                return(MessageBox.Show(message, "Babbot - Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                       MessageBoxDefaultButton.Button1));

            case OBMessageBoxType.Info:
                return(MessageBox.Show(message, "Babbot - Info", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                       MessageBoxDefaultButton.Button1));

            case OBMessageBoxType.CriticalError:
                return(MessageBox.Show(message, "Babbot - Critical Error", MessageBoxButtons.OK, MessageBoxIcon.Stop,
                                       MessageBoxDefaultButton.Button1));

            case OBMessageBoxType.Warning:
                return(MessageBox.Show(message, "Babbot - Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning,
                                       MessageBoxDefaultButton.Button1));

            default:
                throw new ArgumentException("Invalid message type provided. Cannot show message box!", "messageType");
            }
        }
コード例 #2
0
ファイル: Output.cs プロジェクト: iwaitu/babbot
 /// <summary>
 /// Displays a message box with the specified message, and message type.
 /// This is basically MessageBox.Show with a default OK button, and Icon/Sound.
 /// This method is more-or-less to keep the CLR happy.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <param name="messageType">Type of the message.</param>
 internal DialogResult MsgBox(string message, OBMessageBoxType messageType)
 {
     if (String.IsNullOrEmpty(message))
     {
         throw new ArgumentException("Invalid message passed. Cannot display message box!", "message");
     }
     switch (messageType)
     {
         case OBMessageBoxType.Error:
             return MessageBox.Show(message, "Babbot - Error", MessageBoxButtons.OK, MessageBoxIcon.Error,
                                    MessageBoxDefaultButton.Button1);
         case OBMessageBoxType.Info:
             return MessageBox.Show(message, "Babbot - Info", MessageBoxButtons.OK, MessageBoxIcon.Information,
                                    MessageBoxDefaultButton.Button1);
         case OBMessageBoxType.CriticalError:
             return MessageBox.Show(message, "Babbot - Critical Error", MessageBoxButtons.OK, MessageBoxIcon.Stop,
                                    MessageBoxDefaultButton.Button1);
         case OBMessageBoxType.Warning:
             return MessageBox.Show(message, "Babbot - Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning,
                                    MessageBoxDefaultButton.Button1);
         default:
             throw new ArgumentException("Invalid message type provided. Cannot show message box!", "messageType");
     }
 }