Beispiel #1
0
        private void AddUser(User user)
        {
            if (InvokeRequired)
            {
                AddUserCallback ucb = AddUser;
                Invoke(ucb, new object[] { user });
            }
            else
            {
                var items = userListView.Items;
                if (!items.ContainsKey(user.UserId.ToString()))
                {
                    user.Updated += UpdateUser;

                    if (user.Image != null)
                    {
                        userListView.LargeImageList.Images.Add(user.UserId.ToString(), user.Image);
                    }

                    var item = new WiredListViewItem(user,
                                                     new[] { user.Nick, user.Status }, user.UserId.ToString());
                    items.Add(item);
                }
            }
        }
Beispiel #2
0
        private WiredListViewItem FindUserById(User user)
        {
            var items           = userListView.Items;
            WiredListViewItem u = null;

            foreach (WiredListViewItem wli in items)
            {
                if (wli.UserItem.UserId == user.UserId)
                {
                    u = wli;
                }
            }

            return(u);
        }