public void PerformSearch(DownloadSearchCriteria crit) { this.Cursor = Cursors.Wait; TorrentSearchStatus = string.Format("Searching..."); try { CurrentSearchCriteria = crit; this.IsEnabled = false; if (crit.SearchType != DownloadSearchType.Manual) { string desc = ""; foreach (string parm in crit.GetParms()) { if (!string.IsNullOrEmpty(desc)) { desc += " "; } desc += parm; } txtSearch.Text = desc; } SubGroups.Clear(); TorrentLinks.Clear(); ViewTorrentLinks.Refresh(); searchWorker.RunWorkerAsync(crit); } catch (Exception ex) { Utils.ShowErrorMessage(ex); } }
private void ShowSearchResults(DownloadSearchCriteria dsc, List<TorrentLink> results) { if (!dummyPageSearch.Visible) return; m_Facade.Clear(); if (dsc.SearchType == DownloadSearchType.Episode) { AnimeEpisodeVM ep = dsc.SearchParameter as AnimeEpisodeVM; ShowEpisodeDetails(ep); } else dummyEpisodeSearch.Visible = false; SetGUIProperty(GuiProperty.Search_Summary, string.Format("{0}", dsc)); foreach (TorrentLink link in results) { GUIListItem item = null; item = new GUIListItem(); string tname = link.TorrentName; if (tname.Length > 50) tname = tname.Substring(0, 50) + "..."; item.Label = string.Format("({0}) {1} ({2})", link.Source, tname, link.Size); item.TVTag = link; m_Facade.Add(item); BaseConfig.MyAnimeLog.Write("TORRENT: " + item.Label); } SetGUIProperty(GuiProperty.Search_ResultDescription, string.Format("{0} {1}", results.Count, results.Count == 1 ? Translation.Result : Translation.Results)); }
void btnSearch_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtSearch.Text)) { return; } DownloadSearchCriteria crit = new DownloadSearchCriteria(DownloadSearchType.Manual, txtSearch.Text.Trim()); PerformSearch(crit); }
void btnSearch_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(txtSearch.Text)) { return; } DownloadSearchCriteria crit = new DownloadSearchCriteria(DownloadSearchType.Manual, (txtSearch.Text.Trim().Split(new [] { ' ' }, StringSplitOptions.RemoveEmptyEntries)).ToList(), null, null); PerformSearch(crit); }
void searchWorker_DoWork(object sender, DoWorkEventArgs e) { try { DownloadSearchCriteria crit = e.Argument as DownloadSearchCriteria; List <TorrentLinkVM> links = DownloadHelper.SearchTorrents(crit); e.Result = links; } catch (Exception ex) { } }