/// <summary>
        /// Add a message to the console window.
        /// </summary>
        /// <param name="Message">The message text to send to the console window</param>
        /// <param name="MessageType">The type of message to send to the console window (mostly defining the way that the text displays)</param>
        public void AddMessage(string Message, MessageEventArgs.MessageTypes MessageType)
        {
            var msg = new MessageEventArgs(Message, MessageType);

            consoleQueue.Enqueue(msg);
            DisplayMessage(msg);
        }
        /// <summary>
        /// Broadcast a status event to anyone who's listening
        /// </summary>
        /// <param name="Message"></param>
        /// <param name="MessageType"></param>
        private void BroadcastStatusMessage(string Message, MessageEventArgs.MessageTypes MessageType)
        {
            EventHandler<MessageEventArgs> handler = OnStatusMessage;

            if (handler != null)
                handler(this, new MessageEventArgs(Message, MessageType));
        }
 /// <summary>
 /// Status Message event handle.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void viewModel_StatusMessage(object sender, MessageEventArgs e)
 {
     // Just pass the message on to the console.
     this.laConsole.AddMessage(e.Message, e.MessageType);
 }
        /// <summary>
        /// Append a message to the console window.
        /// </summary>
        /// <param name="Msg">The message object display to the console window</param>
        private void DisplayMessage(MessageEventArgs Msg)
        {
            Color clr;

            // For now, the message type only defines the color of the message.
            switch (Msg.MessageType)
            {
                case MessageEventArgs.MessageTypes.Error:
                    clr = Color.Red;
                    break;
                case MessageEventArgs.MessageTypes.Warning:
                    clr = Color.Pink;
                    break;
                case MessageEventArgs.MessageTypes.Important:
                    clr = Color.DarkGreen;
                    break;
                default:
                    clr = Color.Black;
                    break;
            }

            // These messages mostly arrive on a thread other than the UI thread.
            // If that it the case, use Invoke to run on the UI thread.
            if (this.consoleText.InvokeRequired)
            {
                this.Invoke((MethodInvoker)delegate
                {
                    this.consoleText.SelectionColor = clr;
                    this.consoleText.AppendText(Msg.Message);
                    this.consoleText.ScrollToCaret();
                });
            }
            else
            {
                this.consoleText.SelectionColor = clr;
                this.consoleText.AppendText(Msg.Message);
                this.consoleText.ScrollToCaret();
            }
        }
 /// <summary>
 /// Add a message to the console window.
 /// </summary>
 /// <param name="Msg">The message object to send to the console window</param>
 public void AddMessage(MessageEventArgs Msg)
 {
     consoleQueue.Enqueue(Msg);
     DisplayMessage(Msg);
 }