public void CompletedScan(object sender, Series.ScanCompletedEventArgs args) { SeriesCompletedScan((Series)sender, args.episodesScanned , args.newEpisodesFound); }
public void NewEpisodeInSeries(object sender, Series.NewEpisodeEventArgs args) { NewEpisodeFound((Series)sender, args.episode, "New episode: "); }
void Load() { List<string> fileContent = _episodeDataFile.GetFileContent(); foreach(string latestViewedEpisodeData in fileContent) { Series series = new Series(); series.Load(latestViewedEpisodeData); seriesList.Add(series); series.NewEpisodeFound += NewEpisodeInSeries; series.CompletedScan += CompletedScan; } }
private void NewEpisodeFoundHandler(object sender, Series.NewEpisodeEventArgs e) { status += System.Environment.NewLine + string.Format(Constants.MESSAGE_NEWEPISODEFOUND, e.episode.Title(), e.episode.EpisodeID()); }
private void LoadSeries() { List<string> latestViewedEpisodeDataList = _episodeDataFile.GetFileContent(); foreach(string latestViewedEpisodeData in latestViewedEpisodeDataList) { Series series = new Series(); series.Load(latestViewedEpisodeData); series.CompletedScan += ScanCompletedHandler; series.NewEpisodeFound += NewEpisodeFoundHandler; series.BetterEpisodeFound += BetterEpisodeHandler; _allSeries.Add(series); } }
private void BetterEpisodeHandler(object sender, Series.BetterEpisodeEventArgs e) { status += System.Environment.NewLine + string.Format(Constants.MESSAGE_BETTEREPISODEFOUND, e.oldEpisode.Title(), e.newEpisode.CommentCount()); }
//private void DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) //{ // WebBrowser browser = (WebBrowser)sender; // string html = browser.Document.ActiveElement.InnerHtml; // _htmlDocuments.Add(html); // _documentsWaitingToLoad -= 1; // if(_documentsWaitingToLoad == 0) // { // List<Episode> allNewEpisodes = new List<Episode>(); // foreach(string htmlDocument in _htmlDocuments) //scan all html documents and tabulate list of episodes // { // List<Episode> newEpisodes = KickassParser.IdentifyEpisodes(htmlDocument); // allNewEpisodes.AddRange(newEpisodes); // } // foreach (Series series in _allSeries) //scan from tabulated list of new episodes // { // series.ScanForNew(allNewEpisodes); // } // base.Completed(this, new ActionCompletedEventArgs(status.Trim())); // } //} //public override void ReceiveHTMLData(List<string> htmlDocuments) //{ // if(_waitingToReceiveHTMLDocuments == true) // { // foreach (string htmlDocument in htmlDocuments) // { // List<Episode> episodes = KickassParser.IdentifyEpisodes(htmlDocument); // foreach (Series series in _allSeries) // { // series.ScanForNew(episodes); // } // } // base.Completed(this, new ActionCompletedEventArgs(status)); // _waitingToReceiveHTMLDocuments = false; // } //} private void ScanCompletedHandler(object sender, Series.ScanCompletedEventArgs e) { Series series = (Series)sender; status += System.Environment.NewLine + string.Format(Constants.MESSAGE_SCANCOMPLETED, series.Title(), e.newEpisodesFound, e.episodesScanned); _scannedSeriesCount++; if(_scannedSeriesCount == _allSeries.Count()) { base.NotifyActionCompleted(this, new ActionCompletedEventArgs(status)); } }