private void MaxPostNumberFilter() { if (Vm.MaxPostNumber >= 0) { PostsToFilter = PostsToFilter.Where(post => post.Number <= Vm.MaxPostNumber); } }
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); } }
private void FavoriteFilter() { if (Vm.FavoritedOnly) { PostsToFilter = PostsToFilter.Where(s => s.IsFavorited); } }
private void SavedFilter() { if (Vm.SavedOnly) { PostsToFilter = PostsToFilter.Where(s => s.IsSaved); } }
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; } }
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; } } }