private void ApplyToggleFilter()
        {
            IEnumerable <Book> filteredBooks = _bookDomain.GetAllBooks().ToList();

            if (ToggleScraped)
            {
                filteredBooks = filteredBooks.Where(x => x.Scraped).ToList();
            }
            if (ToggleFavourite)
            {
                filteredBooks = filteredBooks.Where(x => x.Favourite).ToList();
            }
            AllBooks = new ObservableCollection <Book>(filteredBooks);

            Books = CollectionViewSource.GetDefaultView(AllBooks);
            Books.Refresh();
        }
Пример #2
0
        public List <string> Go()
        {
            var allBooks = _bookDomain.GetAllBooks();

            foreach (var book in allBooks)
            {
                var exploded = book.Title.Split(' ');
                foreach (var s in exploded)
                {
                    if (!_removedwords.Contains(s.ToLower()))
                    {
                        words.Add(s);
                    }
                }
            }
            var grouped = words.GroupBy(s => s).Select(group => new { Word = group.Key, Count = group.Count() }).ToList();

            grouped.Sort((a, b) => b.Count - a.Count);
            return(words);
        }