public async Task <IEnumerable <IPost> > GetAsync(IWallHolder wallHolder, PullerSettings settings, CancellationToken ct)
        {
            var postList = new List <IPost>();

            postList.AddRange(await getPostsWithAnOffset(wallHolder.ID, 100, 0, ct));
            postList.Sort((a, b) => a.Date.CompareTo(b.Date));
            return(postList);
        }
예제 #2
0
        public async Task <IEnumerable <IPost> > GetAsync(IWallHolder wallHolder, PullerSettings settings, CancellationToken ct)
        {
            var postList = new List <IPost>();

            postList.AddRange(await getPostsOfPage(wallHolder.ID, ITEMS_PER_PAGE, 0));
            postList.Sort((a, b) => b.Date.CompareTo(a.Date));
            return(postList);
        }
예제 #3
0
        public WallItem([NotNull] IWallHolder wallHolder)
        {
            if (wallHolder == null)
            {
                throw new ArgumentNullException(nameof(wallHolder));
            }

            WallHolder   = wallHolder;
            ClickCommand = new DelegateCommand(() => OnClicked(this));

            Name  = WallHolder.Name;
            Photo = WallHolder.Photo50;
        }
예제 #4
0
        public async Task <IEnumerable <IPost> > GetAsync(IWallHolder wallHolder, PullerSettings settings, CancellationToken ct)
        {
            var timePeriodSettings = settings as TimePeriodSettings;

            if (timePeriodSettings == null)
            {
                var noSettings = settings as NoPullerSettings;
                if (noSettings == null)
                {
                    throw new VkException("Не предоставлены корректные настройки");
                }
            }

            var days = timePeriodSettings?.Days ?? 1;

            var postList = new List <IPost>();

            const int postsToPull = 25;
            int       offset      = 0;

            while (true)
            {
                postList.AddRange(await getPostsWithAnOffset(wallHolder.ID, postsToPull, offset, ct));
                offset += postsToPull;
                if (postList.LastOrDefault().Date > days)
                {
                    ;
                }
            }

            if (postList.Count == 100)
            {
                postList.AddRange(await getPostsWithAnOffset(wallHolder.ID, 50, 100, ct));
            }
            postList.Sort((a, b) => a.Date.CompareTo(b.Date));
            return(postList);
        }
 public Task <IEnumerable <IPost> > GetAsync(IWallHolder wallHolder, PullerSettings settings)
 {
     return(GetAsync(wallHolder, settings, CancellationToken.None));
 }
예제 #6
0
 private void OnWallHolderChanged(IWallHolder e)
 {
     logger.Trace($"WallHolder был изменен. Новое Id - {e.ID}, Name - {e.Name}");
     WallHolderChanged?.Invoke(this, e);
 }
예제 #7
0
 public SharedWallContext()
 {
     _selectedWallHolder = new WallHolder(0);
 }
예제 #8
0
 private void onPostponedWallHolderChanged(object sender, IWallHolder holder)
 {
     //var thisGroup = await _vkApi.GroupsGetById.GetAsync(holder.ID);
     IsGroup  = holder.ID < 0;
     WallName = holder?.Name;
 }
 private void onPostponedWallHolderChanged(object sender, IWallHolder wallHolder)
 {
     Name        = wallHolder.Name;
     Description = wallHolder.Description;
     SetProfilePhoto(wallHolder.Photo200);
 }