Beispiel #1
0
 private void btConnect_Click(object sender, EventArgs e)
 {
     try
     {
         client = new Client(tbName.Text, tbPassword.Text);
         client.Start(IPAddress.Parse(tbAddress.Text), Int32.Parse(tbPort.Text));
         if (client.IsConnected)
         {
             chatForm = new ChatForm(client, this);
             chatForm.Show();
         }
     }
     catch
     {
         MessageBox.Show("Error");
     }
 }
Beispiel #2
0
        public void listBox1_DoubleClick(object sender, EventArgs e)
        {
            if (listBox1.Items.Count == 0)
            {
                Mes("当前暂无在线用户。");
                return;
            }
            foreach (var item in friendIPPort)
            {
                if (item.Key == (string)listBox1.SelectedItem)
                {
                    string[] ss33 = item.Value.Split(':');
                    sIP   = ss33[0];
                    sPort = ss33[1];
                }
            }

            ChatForm cf = new ChatForm();

            cf.Show();
        }