public void AdvancedFilter(string searchString, CheckedListBox.CheckedItemCollection checkedItems) { // Start from scratch gridView.Items.Clear(); // Repopulate if empty search if (checkedItems.Count == 0 || searchString == "") { fullList.ForEach(item => gridView.Items.Add(item)); return; } // For each video file showing: fullList.ForEach(item => { // Big Linq Statement Translation: // - Find tag entries from file that match type of checked items // - Any entry that contains the search string, add that file to view var file = (VideoFile)item.Tag; if (checkedItems.Cast<Tag>().Select(tag => file.Tags.Find(entry => entry.TypeId == tag.Id)). Any(match => match != null && match.Data.ToLower().Contains(searchString.ToLower()))) { gridView.Items.Add(item); } }); }
public static Queue<DownloadableProgram> GetProgramsQueueFromCheckedListControl(CheckedListBox.CheckedItemCollection items) { var downloadLinksResult = new Queue<DownloadableProgram>(); var downloadLinks = items.Cast<DownloadableProgram>(); downloadLinks.ForEach(dl => downloadLinksResult.Enqueue(dl)); return downloadLinksResult; }