Ejemplo n.º 1
0
 public void managePrivateChat(List <string> parts)
 {
     this.Invoke((MethodInvoker) delegate // To Write the Received data
     {
         if (parts[3].Equals("new"))
         {
             formPrivate privateC = new formPrivate(parts[2], clientSocket, name);
             nowChatting.Add(parts[2]);
             privateC.Text = "Private Chat with " + parts[2];
             privateC.Show();
         }
         else
         {
             if (Application.OpenForms["formPrivate"] != null)
             {
                 (Application.OpenForms["formPrivate"] as formPrivate).setHistory(parts[3]);
             }
         }
     });
 }
Ejemplo n.º 2
0
        private void privateChatToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedIndex != -1)
            {
                String clientName = listBox1.GetItemText(listBox1.SelectedItem);
                chat.Clear();
                chat.Add("pChat");
                chat.Add(clientName);
                chat.Add(name);
                chat.Add("new");

                byte[] outStream = ObjectToByteArray(chat);
                serverStream.Write(outStream, 0, outStream.Length);
                serverStream.Flush();

                formPrivate privateChat = new formPrivate(clientName, clientSocket, name);
                nowChatting.Add(clientName);
                privateChat.Text = "Private Chat with " + clientName;
                privateChat.Show();
                chat.Clear();
            }
        }