예제 #1
0
        private void ReadUsers(User currentUser)
        {
            List <UserRow> list;

            if (userNameFilter == null)
            {
                // Query all users
                List <User> source = client.QueryUsers(null);
                list = new List <UserRow>(source.Count);

                foreach (User user in source)
                {
                    list.Add(new UserRow(user));
                }
            }
            else
            {
                // Query own user.
                if (currentUser == null)
                {
                    currentUser = client.QueryUser(null, userNameFilter);
                }
                list = new List <UserRow>(1);

                if (currentUser != null)
                {
                    list.Add(new UserRow(currentUser));
                }
            }

            users = new BindingList <UserRow>(list);
            bindingSourceUsers.DataSource = users;
        }