コード例 #1
0
        private void listaContactos_DoubleClick(object sender, EventArgs e)
        {
            KeyValuePair <string, bool> contactSelected = (KeyValuePair <string, bool>)listaContactos.SelectedItems[0].Tag;

            if (contactSelected.Value)
            {
                VentanaDeChat vt = CreateChatWindow(contactSelected.Key);
                vt.Show();
            }
            else
            {
                MessageBox.Show("No es posible chatear con " + contactSelected.Key + ", esta desconectado.",
                                "Contacto Desconectado", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
 void EventChatMessageReceived(object sender, ChatMessageEventArgs e)
 {
     this.BeginInvoke((Action)(delegate
     {
         if (this.chatWindows.ContainsKey(e.ClientFrom))
         {
             //ya estaba chateando con ese cliente
             chatWindows[e.ClientFrom].WriteMessage(e);
         }
         else
         {
             //una nueva ventana de chat
             VentanaDeChat vt = CreateChatWindow(e.ClientFrom);
             vt.WriteMessage(e);
             vt.Show();
         }
     }));
 }
コード例 #3
0
        private VentanaDeChat CreateChatWindow(string chattingWith)
        {
            VentanaDeChat vt;

            if (chatWindows.ContainsKey(chattingWith))
            {
                vt = chatWindows[chattingWith];
            }
            else
            {
                vt = new VentanaDeChat(chattingWith, this);
                chatWindows.Add(chattingWith, vt);
            }
            if (vt != null)
            {
                vt.Focus();
            }
            return(vt);
        }