private async Task GetCategory(Theme theme) { Func<Task<IBitmap>> lazyImageFactory = async () => { var feed = await _rssReader.GetFeed(theme.FeedUrl); var firstImageFromFeed = _rssReader.GetFirstImageMetaData(feed); firstImageFromFeed.Category = theme.Name; return await _downloadManager.DownloadImage(firstImageFromFeed.imageThumbnail); }; var categoryItem = new CategoryItem(theme.FeedUrl, theme.Name, lazyImageFactory); CategoryItems.Add(categoryItem); await categoryItem.LoadImage(); }
private async Task GetCategory(Theme theme) { try { //var feed = await _rssReader.GetFeed(); //var firstImageFromFeed = _rssReader.GetImageMetaData(feed).First(); // firstImageFromFeed.Category = theme.Name; await Execute.OnUIThreadAsync(async () => { var categoryItem = new CategoryItem(theme.FeedUrl, theme.Name); CategoryItems.Add(categoryItem); }); } catch (Exception e) { if (!shown) { shown = true; //MessageBox.Show("Please check your network connection"); } } }