Пример #1
0
		public void OwnerRemoved (User user)
		{
			if (RemoveUser (user)) {
				AddUser (user);
				Update ();
			}
		}
Пример #2
0
		bool RemoveUser (User user)
		{
			return RemoveUser (user.Id);
		}
Пример #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));
		}
Пример #4
0
		public void UserJoined (User user)
		{
			RemoveUser (user);
			AddUser (user);
			Update ();
		}
Пример #5
0
		TreeItem CreateItem (User user)
		{
			return new TreeItem { Text = user.Name, Key = user.Id, Tag = user };
		}
Пример #6
0
		public void UserLeft (User user)
		{
			RemoveUser (user);
			Update ();
		}
Пример #7
0
		public void UsernameChanged (string oldUserId, User user)
		{
			if (RemoveUser (oldUserId)) {
				AddUser (user);
			}
			Update ();
		}
Пример #8
0
 TreeItem CreateItem(User user)
 {
     return new TreeItem { Text = user.Name, Key = user.Id, Tag = user, Image = Channel.Server.GetUserIcon(user) };
 }
Пример #9
0
		public abstract void StartChat (User user);
Пример #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;
 }
Пример #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);
     }
 }
Пример #12
0
 public UsernameChangedEventArgs(string oldName, User user, DateTimeOffset when)
     : base (user, when)
 {
     this.OldUsername = oldName;
 }
Пример #13
0
 public UserEventArgs(User user, DateTimeOffset when)
 {
     this.User = user;
     this.When = when;
 }
Пример #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;
        }
Пример #15
0
 public UserImageEventArgs(User user, DateTimeOffset when, Image image)
     : base (user, when)
 {
     this.Image = image;
 }
Пример #16
0
		public UserChannelEventArgs(User user, Channel channel)
		{
			this.User = user;
			this.Channel = channel;
		}