예제 #1
0
 private void sendMessageToolStripMenuItem_Click(object sender, EventArgs e)
 {
     int userid = channels.GetSelectedUser();
     MessageDlg dlg;
     if (msgdialogs.TryGetValue(userid, out dlg))
         dlg.Show();
     else
     {
         dlg = new MessageDlg(ttclient, userid);
         dlg.FormClosed += new FormClosedEventHandler(dlg_MessageDlgClosed);
         dlg.Show();
         msgdialogs.Add(userid, dlg);
     }
 }
예제 #2
0
 void ttclient_OnCmdUserTextMessage(TextMessage textmessage)
 {
     switch (textmessage.nMsgType)
     {
         case TextMsgType.MSGTYPE_USER :
             MessageDlg dlg;
             if (msgdialogs.TryGetValue(textmessage.nFromUserID, out dlg))
             {
                 dlg.NewMessage(textmessage);
                 if (!dlg.Visible)
                     dlg.Show();
             }
             else
             {
                 dlg = new MessageDlg(ttclient, textmessage.nFromUserID);
                 dlg.FormClosed += new FormClosedEventHandler(dlg_MessageDlgClosed);
                 dlg.NewMessage(textmessage);
                 dlg.Show();
                 msgdialogs.Add(textmessage.nFromUserID, dlg);
             }
             break;
         case TextMsgType.MSGTYPE_CHANNEL:
             {
                 User user = new User();
                 if (ttclient.GetUser(textmessage.nFromUserID, ref user))
                     chatTextBox.AppendText("<" + user.szNickname + "> " + textmessage.szMessage + Environment.NewLine);
                 break;
             }
         case TextMsgType.MSGTYPE_BROADCAST:
             {
                 User user = new User();
                 if (ttclient.GetUser(textmessage.nFromUserID, ref user))
                 {
                     MessageBox.Show("Broadcast message from " + user.szNickname + Environment.NewLine +
                                     textmessage.szMessage);
                 }
             }
             break;
         case TextMsgType.MSGTYPE_CUSTOM:
             {
             }
             break;
     }
 }