private void btn_login_Click(object sender, EventArgs e) { if (MyIMClient.Connect()) { MyIMClient.Login(tb_username.Text.Trim()); new IMForm().ShowDialog(); } else { MessageBox.Show("连接失败"); } }
private void btn_send_Click(object sender, EventArgs e) { string from = tb_from.Text.Trim(); string to = tb_to.Text.Trim(); string content = tb_content.Text; Msg msg = new Msg(from, to, content); MyIMClient.SendMsg(msg); builder.AppendFormat("{0} {1}", msg.Time, msg.From).AppendLine(); builder.AppendLine(msg.Content); builder.AppendLine(); tb_received.Text = builder.ToString();; }
private void IMForm_FormClosed(object sender, FormClosedEventArgs e) { MyIMClient.Close(); }