virtual protected void OnMessageReceived(IMReceivedEventArgs e) { if (MessageReceived != null) { MessageReceived(this, e); } }
void client_MessageReceived(object sender, IMReceivedEventArgs e) { this.BeginInvoke(new MethodInvoker(delegate { if (e.From == sendTo) { if (e.Message.Contains("<I>")) { SystemSounds.Exclamation.Play(); String message = e.Message.Substring(0, e.Message.Length - 3); messageList.Text += String.Format("[{0}] {1}\r\n", e.From, message); } else { messageList.Text += String.Format("[{0}] {1}\r\n", e.From, e.Message); } } })); }