Exemplo n.º 1
0
        protected override async Task DoReceive()
        {
            if (_listId == null)
            {
                // get description
                var list = (await ReceiveListDescription(_auth, _listInfo));
                await ListProxy.SetListDescription(list);

                _listId = list.Id;
            }
            // if list data is not found, abort receiving timeline.
            if (_listId == null)
            {
                return;
            }
            var id       = _listId.Value;
            var users    = (await ReceiveListMembers(_auth, id)).OrderBy(l => l).ToArray();
            var oldUsers = (await ListProxy.GetListMembers(id)).OrderBy(l => l).ToArray();

            if (users.SequenceEqual(oldUsers))
            {
                // not changed
                return;
            }
            // commit changes
            await ListProxy.SetListMembers(id, users);

            ListMemberChanged.SafeInvoke();
        }
Exemplo n.º 2
0
 private async void UsersChanged(IEnumerable <long> userIds)
 {
     if (!_members.SyncSet(userIds))
     {
         return;
     }
     if (_receiver.ListId != null)
     {
         await ListProxy.SetListMembers(_receiver.ListId.Value, _members);
     }
     ListMemberChanged?.Invoke(this, Tuple.Create(_listParam, _members.AsEnumerable()));
 }