private object UpdateFeeds(object state) { checkForCancellation(); InnerTubeFeed feed = ((InnerTubeFeed)state).Clone(); ObservableCollection <InnerTubeVideo> newVideos = InnerTubeService.ConvertYouTubeXmlToObjects(new Uri(feed.FeedUrl), this.settings); //pull just videos we don't have yet var newVids = from a in newVideos from b in (from n in newVideos select n.Id).Except(from o in feed.FeedVideos select o.Id) where a.Id == b select a; foreach (var n in newVids) { feed.FeedVideos.Add(n); } string status = "updated feed: " + feed.FeedName; WriteStatus(status); return(feed); }
public InnerTubeFeed Clone() { InnerTubeFeed copy = (InnerTubeFeed)((ICloneable)this).Clone(); ObservableCollection <InnerTubeVideo> feedVideoCopy = new ObservableCollection <InnerTubeVideo>(); if (this.FeedVideos != null) { foreach (var v in this.FeedVideos) { feedVideoCopy.Add(v.Clone()); } copy.FeedVideos = feedVideoCopy; return(copy); } else { copy.FeedVideos = new ObservableCollection <InnerTubeVideo>(); return(copy); } }
public static void Delete(System.Collections.ObjectModel.ObservableCollection <InnerTubeFeed> feedList, InnerTubeFeed deleteFeed) { feedList.Remove(deleteFeed); }