public void OwnerRemoved (User user) { if (RemoveUser (user)) { AddUser (user); Update (); } }
bool RemoveUser (User user) { return RemoveUser (user.Id); }
void AddUser (User user) { var isOwner = Channel.Owners.Contains (user.Id); TreeItem item = isOwner ? owners : user.Active ? online : away; item.Children.Add (CreateItem (user)); }
public void UserJoined (User user) { RemoveUser (user); AddUser (user); Update (); }
TreeItem CreateItem (User user) { return new TreeItem { Text = user.Name, Key = user.Id, Tag = user }; }
public void UserLeft (User user) { RemoveUser (user); Update (); }
public void UsernameChanged (string oldUserId, User user) { if (RemoveUser (oldUserId)) { AddUser (user); } Update (); }
TreeItem CreateItem(User user) { return new TreeItem { Text = user.Name, Key = user.Id, Tag = user, Image = Channel.Server.GetUserIcon(user) }; }
public abstract void StartChat (User user);
ITreeItem FindUserItem(User user) { var item = owners.Children.FirstOrDefault(r => r.Key == user.Id); if (item != null) return item; item = online.Children.FirstOrDefault(r => r.Key == user.Id); if (item != null) return item; item = away.Children.FirstOrDefault(r => r.Key == user.Id); if (item != null) return item; return null; }
public void UserIconChanged(User user, Image image) { var item = FindUserItem(user) as TreeItem; if (item != null) { item.Image = image; //tree.RefreshData (); tree.RefreshItem(item); } }
public UsernameChangedEventArgs(string oldName, User user, DateTimeOffset when) : base (user, when) { this.OldUsername = oldName; }
public UserEventArgs(User user, DateTimeOffset when) { this.User = user; this.When = when; }
public Bitmap GetUserIcon(User user) { if (iconCache.Contains(user.Id)) { var icon = iconCache[user.Id] as Bitmap; if (icon != null) return icon; } user.GetIcon().ThenOnUI(image => { var policy = new CacheItemPolicy { SlidingExpiration = TimeSpan.FromMinutes (60) }; iconCache.Set(user.Id, image, policy); foreach (var channel in this.Channels) { if (channel.Users.Any(r => r.Id == user.Id)) { channel.TriggerUserIconChanged(new UserImageEventArgs(user, DateTimeOffset.Now, image)); } } }); return User.DefaultUserIcon; }
public UserImageEventArgs(User user, DateTimeOffset when, Image image) : base (user, when) { this.Image = image; }
public UserChannelEventArgs(User user, Channel channel) { this.User = user; this.Channel = channel; }