public void RemoveUnit(IUnit unit) { string recentID = RecentListBox.ConstructRecentID(unit); this.chatListBox.RemoveSubItemsById(recentID); this.chatListBox.Invalidate(); }
public void AddRecentUnit(IUnit unit, int insertIndex) { string recentID = RecentListBox.ConstructRecentID(unit); UserStatus status = unit.IsGroup ? UserStatus.Online : ((GGUser)unit).UserStatus; Image img = unit.IsGroup ? this.imageList1.Images[0] : this.resourceGetter.GetHeadImage((GGUser)unit); ChatListSubItem subItem = new ChatListSubItem(recentID, "", unit.Name, "", this.ConvertUserStatus(status), img); subItem.Tag = unit; subItem.LastWords = unit.LastWords; this.chatListBox.Items[0].SubItems.Insert(insertIndex, subItem); this.chatListBox.Invalidate(); }
public void UserStatusChanged(GGUser user) { string recentID = RecentListBox.ConstructRecentID(user); ChatListSubItem[] items = this.chatListBox.GetSubItemsById(recentID); if (items == null || items.Length == 0) { return; } items[0].DisplayName = user.Name; items[0].HeadImage = this.resourceGetter.GetHeadImage(user); items[0].Status = this.ConvertUserStatus(user.UserStatus); this.chatListBox.Invalidate(); }
public void LastWordChanged(IUnit unit) { string recentID = RecentListBox.ConstructRecentID(unit); ChatListSubItem[] items = this.chatListBox.GetSubItemsById(recentID); if (items != null && items.Length > 0) { ChatListSubItem item = items[0]; item.LastWords = unit.LastWords; item.OwnerListItem.SubItems.Remove(item); item.OwnerListItem.SubItems.Insert(0, item); } else { this.AddRecentUnit(unit, 0); } this.chatListBox.Invalidate(); }