예제 #1
0
 public void CompletedScan(object sender, Series.ScanCompletedEventArgs args)
 {
     SeriesCompletedScan((Series)sender, args.episodesScanned , args.newEpisodesFound);
 }
예제 #2
0
 public void NewEpisodeInSeries(object sender, Series.NewEpisodeEventArgs args)
 {
     NewEpisodeFound((Series)sender, args.episode, "New episode: ");
 }
예제 #3
0
 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;
     }
 }
예제 #4
0
 private void NewEpisodeFoundHandler(object sender, Series.NewEpisodeEventArgs e)
 {
     status += System.Environment.NewLine + string.Format(Constants.MESSAGE_NEWEPISODEFOUND, e.episode.Title(), e.episode.EpisodeID());
 }
예제 #5
0
 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);
     }
 }
예제 #6
0
 private void BetterEpisodeHandler(object sender, Series.BetterEpisodeEventArgs e)
 {
     status += System.Environment.NewLine + string.Format(Constants.MESSAGE_BETTEREPISODEFOUND, e.oldEpisode.Title(), e.newEpisode.CommentCount());
 }
예제 #7
0
 //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));
     }
 }