/// <summary> /// Retrieves the data from a RSS data source (http://www.dandandin.it/Blog/RSS.aspx?p=1~2~-1&r=f3a58073-d9c8-496e-af7b-f4ee2ae8dd40), in an observable collection of RssSearchResult items. /// </summary> /// <returns>An observable collection of RssSearchResult items.</returns> public async Task <ObservableCollection <EntitiesBase.RssSearchResult> > Refresh() { SyndicationFeed feed; if (_internetService.IsNetworkAvailable()) { feed = await _xmlDataSource.LoadRemote <System.ServiceModel.Syndication.SyndicationFeed>(RssUrl); var defaultImage = feed.ImageUrl != null ? feed.ImageUrl.AbsoluteUri : null; var items = feed != null ? new ObservableCollection <EntitiesBase.RssSearchResult>(feed.Items.Select(i => new EntitiesBase.RssSearchResult(i, defaultImage))) : new ObservableCollection <EntitiesBase.RssSearchResult>(); _storageService.Save("Web_RSS", items); return(items); } return(_storageService.Load <ObservableCollection <EntitiesBase.RssSearchResult> >("Web_RSS")); }
/// <summary> /// Retrieves the data from Youtube (channel: CNETTV ), filtered by a filter specification, in an observable collection of YouTubeVideo items. /// </summary> /// <param name="filter">Filter operation specification</param> /// <returns>An observable collection of YouTubeVideo items.</returns> public async Task <ObservableCollection <EntitiesBase.YouTubeVideo> > Search(FilterSpecification filter) { var data = _storageService.Load <EntitiesBase.YouTubeVideo[]>("Videos_s5"); var searchResults = RepositoriesBase.Filter <EntitiesBase.YouTubeVideo> .FilterCollection(filter, data); if (searchResults == null || !searchResults.Any()) { data = await _youtubeDataSource.LoadRemote <EntitiesBase.YouTubeVideo[]>(String.Format(YoutubeBaseUrl, HttpUtility.UrlEncode(YoutubeQuery))); searchResults = RepositoriesBase.Filter <EntitiesBase.YouTubeVideo> .FilterCollection(filter, data); } return(searchResults); }