Exemple #1
0
 public void updateMessageList(RichTextBox messageList, ludo_client.dto.Message newIncomingMessage)
 {
     if (messageList.InvokeRequired)
     {
         // We're on a thread other than the GUI thread
         messageList.Invoke(new MethodInvoker(() => updateMessageList(messageList, newIncomingMessage)));
         return;
     }
     String timeStampSecond = newIncomingMessage.TimeStamp.Second.ToString();
     if (timeStampSecond.Length == 1)
     {
         timeStampSecond = "0" + timeStampSecond;
     }
     String timeStamp = "[" + newIncomingMessage.TimeStamp.ToShortTimeString() +
         ":" + timeStampSecond  + "]";
     String sender = newIncomingMessage.Sender.UserName;
     String message = newIncomingMessage.Msg;
     messageList.AppendText(timeStamp + " ", Color.Gray);
     messageList.AppendText(sender + ": " , Color.Blue);
     messageList.AppendText(message + "\n");
     messageList.ScrollToCaret();
 }
Exemple #2
0
 private int setMessageTargetID(ludo_client.dto.Message message)
 {
     if (this.chatTabControl.SelectedIndex > 0)
     {
         return Main.ludo.Users[ClientBase.myUserListIndex].CurrentRoomID; // room chat
     }
     else
     {
         return -1; // global server chat
     }
 }
Exemple #3
0
 public void sendMessage(ludo_client.dto.Message message)
 {
     websocket.Send(JsonConvert.SerializeObject(message));
 }