Ejemplo n.º 1
0
 private void AppendReceivedTextMessage(string receivedMessageText)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.rtbMessages.InvokeRequired)
     {
         AppendReceivedTextMessageCallback d = new AppendReceivedTextMessageCallback(AppendReceivedTextMessage);
         this.Invoke(d, new object[] { receivedMessageText });
     }
     else
     {
         var date = DateTime.Now;
         this.rtbMessages.AppendText(date.Hour + ":" + date.Minute + " " + receivedMessageText + "\r\n");
     }
 }
Ejemplo n.º 2
0
 private void AppendReceivedTextMessage(string receivedMessageText)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.rtbMessages.InvokeRequired)
     {
         AppendReceivedTextMessageCallback d = new AppendReceivedTextMessageCallback(AppendReceivedTextMessage);
         this.Invoke(d, new object[] { receivedMessageText });
     }
     else
     {
         var date = DateTime.Now;
         this.rtbMessages.AppendText(date.Hour+ ":" + date.Minute + " - Server: " + receivedMessageText + "\r\n");
     }
 }