private void BgwRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Result != null) { var resultObject = e.Result as List <object>; var s0 = resultObject[0] as List <SearchDetails>; var s1 = resultObject[1] as string; var s2 = resultObject[2] as ScanSeries; var toAdd = resultObject[3] as Dictionary <string, ScanSeries>; var toRemove = resultObject[4] as List <string>; var frmSelectSeries = new FrmSelectSeries(s0, s1); frmSelectSeries.ShowDialog(); if (frmSelectSeries.Cancelled) { var seriesname = (from s in ImportTvFactory.SeriesNameList where s.SeriesName == s1 select s).SingleOrDefault(); seriesname.Skipped = true; seriesname.WaitingForScan = false; } else { if (frmSelectSeries.SelectedSeries != null) { ImportTvFactory.ScanSeriesPicks.Add( new ScanSeriesPick { SearchString = s1, SeriesID = frmSelectSeries.SelectedSeries.SeriesID, SeriesName = frmSelectSeries.SelectedSeries.SeriesName }); } var series = this.theTvdb.OpenNewSeries(frmSelectSeries.SelectedSeries); this.Set(series, toRemove, toAdd, s1, s2); } frmSelectSeries.Dispose(); this.ButNextClick(null, null); } else { this.Hide(); var frmNotCatagorized = new FrmNotCatagorized2(); frmNotCatagorized.ShowDialog(); } DatabaseIOFactory.Save(DatabaseIOFactory.OutputName.ScanSeriesPick); }
/// <summary> /// Processes the search results. /// </summary> /// <param name="seriesResults">The series results.</param> /// <param name="searchTerm">The search term.</param> /// <returns> /// The process search results. /// </returns> public SearchDetails ProcessSearchResults(List<SearchDetails> seriesResults, string searchTerm) { if (seriesResults.Count > 1 || seriesResults.Count == 0) { var frmSelectSeriesName = new FrmSelectSeries(seriesResults, searchTerm); frmSelectSeriesName.ShowDialog(); return frmSelectSeriesName.SelectedSeries; } if (seriesResults.Count == 1) { return seriesResults[0]; } return null; }
/// <summary> /// Handles the RunWorkerCompleted event of the Bgw control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.ComponentModel.RunWorkerCompletedEventArgs"/> instance containing the event data.</param> private void Bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (e.Result != null) { var resultObject = e.Result as List<object>; var s0 = resultObject[0] as List<SearchDetails>; var s1 = resultObject[1] as string; var s2 = resultObject[2] as ScanSeries; var toAdd = resultObject[3] as Dictionary<string, ScanSeries>; var toRemove = resultObject[4] as List<string>; var frmSelectSeries = new FrmSelectSeries(s0, s1); frmSelectSeries.ShowDialog(); if (frmSelectSeries.Cancelled) { var seriesname = (from s in ImportTvFactory.SeriesNameList where s.SeriesName == s1 select s).SingleOrDefault(); seriesname.Skipped = true; seriesname.WaitingForScan = false; } else { if (frmSelectSeries.SelectedSeries != null) { var check = (from s in ImportTvFactory.ScanSeriesPicks where s.SearchString == s1 select s).Count() > 0; if (!check) { ImportTvFactory.ScanSeriesPicks.Add( new ScanSeriesPick { SearchString = s1, SeriesID = frmSelectSeries.SelectedSeries.SeriesID, SeriesName = frmSelectSeries.SelectedSeries.SeriesName }); } } var series = this.theTvdb.OpenNewSeries(frmSelectSeries.SelectedSeries); this.Set(series, toRemove, toAdd, s1, s2); } frmSelectSeries.Dispose(); this.ButNext_Click(null, null); } else { this.Hide(); var frmNotCatagorized = new FrmNotCatagorized2(); frmNotCatagorized.ShowDialog(); } DatabaseIOFactory.Save(DatabaseIOFactory.OutputName.ScanSeriesPick); }
/// <summary> /// Processes the search results. /// </summary> /// <param name="seriesResults">The series results.</param> /// <param name="searchTerm">The search term.</param> /// <returns> /// The process search results. /// </returns> public SearchDetails ProcessSearchResults(List<SearchDetails> seriesResults, string searchTerm) { if (seriesResults.Count > 1 || seriesResults.Count == 0) { Factories.UI.Windows7UIFactory.PauseProgressState(); var frmSelectSeriesName = new FrmSelectSeries(seriesResults, searchTerm); frmSelectSeriesName.ShowDialog(); Factories.UI.Windows7UIFactory.PauseProgressState(); return frmSelectSeriesName.SelectedSeries; } if (seriesResults.Count == 1) { return seriesResults[0]; } return null; }