virtual protected void OnUserAvail(IMAvailEventArgs e) { if (UserAvailable != null) { UserAvailable(this, e); } }
void client_UserAvailable(object sender, IMAvailEventArgs e) { this.BeginInvoke(new MethodInvoker(delegate { if (e.UserName == sendTo) { if (lastAvail != e.IsAvailable) { lastAvail = e.IsAvailable; string avail = (e.IsAvailable ? "available" : "unavailable"); this.Text = String.Format("{0} - {1}", sendTo, avail); messageList.Text += String.Format("[{0} is {1}]\r\n", sendTo, avail); } } })); }