/// <summary> /// Initializes a new instance of the <see cref="FeedSource"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="location">The feedlist URL</param> internal BanditFeedSource(INewsComponentsConfiguration configuration, SubscriptionLocation location) { p_configuration = configuration; if (p_configuration == null) { p_configuration = DefaultConfiguration; } this.location = location; // check for programmers error in configuration: ValidateAndThrow(Configuration); LoadFeedlistSchema(); rssParser = new RssParser(this); if (!String.IsNullOrEmpty(EnclosureFolder)) { enclosureDownloader = new BackgroundDownloadManager(this); enclosureDownloader.DownloadCompleted += OnEnclosureDownloadComplete; } AsyncWebRequest = new AsyncWebRequest(); AsyncWebRequest.OnAllRequestsComplete += OnAllRequestsComplete; }
/// <summary> /// Locate the DownloadTask associated with the given background job. /// </summary> /// <param name="pJob">The job reference.</param> /// <returns>The DownloadTask for that job.</returns> private static DownloadTask FindTask(IBackgroundCopyJob pJob) { Guid jobID; pJob.GetId(out jobID); foreach (var task in BackgroundDownloadManager.GetTasks()) { if (task.JobId == jobID) { return(task); } } return(null); }