Пример #1
0
 private void MaxPostNumberFilter()
 {
     if (Vm.MaxPostNumber >= 0)
     {
         PostsToFilter = PostsToFilter.Where(post => post.Number <= Vm.MaxPostNumber);
     }
 }
Пример #2
0
 private void DateRangeFilter()
 {
     if (Vm.UseDateRange && Vm.StartDate.Date <= Vm.EndDate.Date)
     {
         PostsToFilter = PostsToFilter.Where(post => Vm.StartDate.Date <= post.Date.Date && post.Date.Date <= Vm.EndDate.Date);
     }
 }
Пример #3
0
 private void FavoriteFilter()
 {
     if (Vm.FavoritedOnly)
     {
         PostsToFilter = PostsToFilter.Where(s => s.IsFavorited);
     }
 }
Пример #4
0
 private void SavedFilter()
 {
     if (Vm.SavedOnly)
     {
         PostsToFilter = PostsToFilter.Where(s => s.IsSaved);
     }
 }
Пример #5
0
        private void NsfwFilter()
        {
            if (DenyNsfw)
            {
                PostsToFilter = PostsToFilter.Where(s => !s.IsNsfw);
            }

            switch (Vm.NsfwSetting)
            {
            case NsfwSettings.No_Filter:
                break;

            case NsfwSettings.Nsfw_Only:
                PostsToFilter = PostsToFilter.Where(s => s.IsNsfw);
                break;

            case NsfwSettings.No_Nsfw:
                PostsToFilter = PostsToFilter.Where(s => !s.IsNsfw);
                break;
            }
        }
Пример #6
0
        private void SubredditTypeFilter()
        {
            if (!(Subreddits is null))
            {
                List <string> sfwSubs = Subreddits.Where(sub => !sub.IsNsfw).Select(sub => sub.SubredditName).ToList();

                switch (Vm.SubredditTypes)
                {
                case SubredditTypes.All:
                    break;

                case SubredditTypes.Sfw:
                    PostsToFilter = PostsToFilter.Where(posts => sfwSubs.Contains(posts.Subreddit));
                    break;

                case SubredditTypes.Nsfw:
                    PostsToFilter = PostsToFilter.Where(posts => !sfwSubs.Contains(posts.Subreddit));
                    break;
                }
            }
        }