void serverSearch_Click(object sender, EventArgs e) { MainSection section = selectedServerSection as MainSection; ToolStripMenuItem tsi = sender as ToolStripMenuItem; SearchSection searchSection = tsi != null ? tsi.Tag as SearchSection : null; if (OnSearchInput != null && section != null && searchSection != null) { // Show search dialog string query = ""; if (OnSearchInput(searchSection, out query)) { LibrarySection librarySection = searchSection.createFromSearch(query); if (librarySection != null) { librarySection.IsMusic = section.IsMusic; // Add a new child node to the musicsection node TreeNode tn = tvServerSection.SelectedNode.Nodes.Add(librarySection.Key, librarySection.Title); tn.Tag = librarySection; // Select the newly added node in the tree tvServerSection.SelectedNode = tn; } } } }
public bool matchOnTitle(ImportEntry _singleEntry, bool _checkAll) { bool anyMatched = false; var entries = from entry in m_importFile.Entries where ((_checkAll || !entry.Matched) && !String.IsNullOrEmpty(entry.Title)) && (_singleEntry == null || entry == _singleEntry) select entry; string baseMessage = "Find matches based on title.... "; progressMessage(baseMessage, true); foreach (ImportEntry entry in entries) { progressMessage(entry.Title, false); entry.resetMatches(false); foreach (MainSection mainSection in m_mainSections) { SearchSection searchSection = mainSection.TitleSearchSection(); LibrarySection librarySection = (searchSection != null) ? searchSection.createFromSearch(entry.Title) : null; if (librarySection != null) { librarySection.IsMusic = mainSection.IsMusic; var tracks = from track in PMSServer.getSectionElements(librarySection, false) select track; foreach (XElement trackElement in tracks) { if (entry.AddMatch(new MatchEntry(mainSection, trackElement))) { anyMatched = true; } } } } entry.CheckBestMatch(); } progressMessage("", true); return(anyMatched); }