Example #1
0
		public void OwnerRemoved (User user)
		{
			if (RemoveUser (user)) {
				AddUser (user);
				Update ();
			}
		}
Example #2
0
		bool RemoveUser (User user)
		{
			return RemoveUser (user.Id);
		}
Example #3
0
		void AddUser (User user)
		{
			var isOwner = Channel.Owners.Contains (user.Id);
			TreeItem item = isOwner ? owners : user.Active ? online : away;
			item.Children.Add (CreateItem (user));
		}
Example #4
0
		public void UserJoined (User user)
		{
			RemoveUser (user);
			AddUser (user);
			Update ();
		}
Example #5
0
		TreeItem CreateItem (User user)
		{
			return new TreeItem { Text = user.Name, Key = user.Id, Tag = user };
		}
Example #6
0
		public void UserLeft (User user)
		{
			RemoveUser (user);
			Update ();
		}
Example #7
0
		public void UsernameChanged (string oldUserId, User user)
		{
			if (RemoveUser (oldUserId)) {
				AddUser (user);
			}
			Update ();
		}
Example #8
0
 TreeItem CreateItem(User user)
 {
     return new TreeItem { Text = user.Name, Key = user.Id, Tag = user, Image = Channel.Server.GetUserIcon(user) };
 }
Example #9
0
		public abstract void StartChat (User user);
Example #10
0
 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;
 }
Example #11
0
 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;
 }
Example #13
0
 public UserEventArgs(User user, DateTimeOffset when)
 {
     this.User = user;
     this.When = when;
 }
Example #14
0
        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;
        }
Example #15
0
 public UserImageEventArgs(User user, DateTimeOffset when, Image image)
     : base (user, when)
 {
     this.Image = image;
 }
Example #16
0
		public UserChannelEventArgs(User user, Channel channel)
		{
			this.User = user;
			this.Channel = channel;
		}