コード例 #1
0
        private void UpdateUsers(IEnumerable <User> users)
        {
            var newUsers = new List <UserContainer>();

            foreach (var user in users)
            {
                var container = _users.FromId(user.CustId);
                if (container == null)
                {
                    container = new UserContainer(user);
                }
                else
                {
                    container.User = user;
                }

                newUsers.Add(container);
            }

            _users.Clear();

            if (this.Status == ConnectionStatus.Connected)
            {
                foreach (var user in newUsers)
                {
                    _users.Add(user);
                }
            }
            else
            {
                _users.Add(new UserContainer(_offlineUser));
            }

            this.OnUsersUpdated();
        }