コード例 #1
0
 public void addMessageLogText(object sender, MessageEvent e)
 {
     if (this.InvokeRequired)
     {
         MessageEventCallDelegate ev = new MessageEventCallDelegate(addMessageLogText);
         this.BeginInvoke(ev, new object[] { sender, e });
     }
     else
     {
         this.textBox1.AppendText(e.myTime.ToString() + " " + sender.ToString() + ": " + e.ToString() + "\r\n");
     }
 }
コード例 #2
0
        public void addMessageLogText(object sender, MessageEvent e)
        {
            if (e.Verbosity > 0 && !this.softwareTimedTaskLogTextCheckbox.Checked)
                return;

            if (!formLoaded)
                return;

            if (showWarningsErrorsOnly.Checked && e.MessageType != MessageEvent.MessageTypes.Error && e.MessageType != MessageEvent.MessageTypes.Warning)
                return;

            /// This is a closure. Fancy functional makes the code cleaner.
            Action printMessage = () => eventLogTextBox.AppendText(e.MyTime.ToString() + " " + sender.ToString() + ": " + e.ToString() + "\r\n");
            BeginInvoke(printMessage);
        }
コード例 #3
0
        public void addMessageLogText(object sender, MessageEvent e)
        {
            WordGenerator.MainClientForm.instance.handleMessageEvent(sender, e);

            if (this.InvokeRequired)
            {
                EventHandler<MessageEvent> ev = new EventHandler<MessageEvent>(addMessageLogText);
                this.BeginInvoke(ev, new object[] { sender, e });
            }
            else
            {
                MessageEvent message = e as MessageEvent;
                if (message != null)
                {
                    textBox1.AppendText(message.MyTime.ToString() + " " + sender.ToString() + ": " + message.ToString() + "\r\n");
                }
                else
                {
                    textBox1.AppendText(sender.ToString() + ": " + e.ToString() + "\r\n");
                }
            }
        }
コード例 #4
0
 public void addMessageLogText(object sender, MessageEvent e)
 {
     Action addText = () => this.textBox1.AppendText(e.MyTime.ToString() + " " + sender.ToString() + ": " + e.ToString() + "\r\n");
     BeginInvoke(addText);
 }
コード例 #5
0
 public void messageLog(object sender, MessageEvent message)
 {
     if (messageLogHandler != null)
         messageLogHandler(sender, message);
 }
コード例 #6
0
 public void handleMessageEvent(object sender, MessageEvent e)
 {
     addStatusText(sender, e);
     addMessageLogText(sender, e);
 }
コード例 #7
0
 public void addStatusText(object sender, MessageEvent e)
 {
     if (this.InvokeRequired)
     {
         this.BeginInvoke(new EventHandler<MessageEvent>(addStatusText), new object[] { sender, e });
     }
     else
     {
         toolStripStatusLabel.Text = e.ToString();
     }
 }
コード例 #8
0
 private static void safeMessageLog(MessageEvent message)
 {
     if (messageLog != null)
         messageLog(dummy, message);
 }
コード例 #9
0
        public void addMessageLogText(object sender, MessageEvent e)
        {
            if (this.InvokeRequired)
            {
                EventHandler<MessageEvent> ev = addMessageLogText;
                this.BeginInvoke(ev, new object[] { sender, e });
            }
            else
            {

                WordGenerator.MainClientForm.instance.handleMessageEvent(sender, e);
                MessageEvent message = (MessageEvent)e;
                if (!this.IsDisposed)
                {
                    this.textBox1.AppendText(message.MyTime.ToString() + " " + message.ToString() + "\r\n");
                }
            }
        }