void Channel_ChatMessageRecieved(Lib.IRC.Channel chan, Lib.IRC.UserInfo user, string message) { if (this.InvokeRequired) { this.Invoke(new Lib.IRC.Channel.ChatMessageRecievedDelegate(Channel_ChatMessageRecieved), chan, user, message); return; } bool scroll = false; int currTopIndex = lstMessages.TopIndex; int visibleItems = lstMessages.ClientSize.Height / lstMessages.ItemHeight; if (lstMessages.TopIndex >= Math.Max(lstMessages.Items.Count - visibleItems, 0)) { scroll = true; } var dt = DateTime.Now; lstMessages.Items.Add("[" + dt.Hour.ToString("00") + ":" + dt.Minute.ToString("00") + "] " + user.Nick + ": " + message); if (scroll) { lstMessages.TopIndex = Math.Max(lstMessages.Items.Count - visibleItems + 1, 0); } }
void Channel_UserJoined(Lib.IRC.Channel chan, Lib.IRC.UserInfo ui) { if (this.InvokeRequired) { this.Invoke(new Lib.IRC.Channel.UserJoinedDelegate(Channel_UserJoined), chan, ui); return; } UpdateUsers(); }
void Channel_UserChanged(Lib.IRC.Channel chan, Lib.IRC.UserInfo ui) { UpdateUsers(); }