public async Task UpdateFeedAsync() { for (int i = 1; i < Feeds.Count(); i++) { await FeedDataSource.UpdateArticles(Feeds[i]); } Initialized?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Populates the Feeds list and initializes the CurrentFeed and CurrentArticle properties. /// </summary> public async Task InitializeFeedsAsync() { Feeds.Clear(); (await FeedDataSource.GetFeedsAsync()).ForEach(feed => Feeds.Add(feed)); CurrentFeed = Feeds[Feeds.Count == 1 ? 0 : 1]; //CurrentArticle = CurrentFeed.Articles.FirstOrDefault() ?? CurrentArticle; if (FavoritesFeed.Articles.Count == 0) { FavoritesFeed.ErrorMessage = NO_ARTICLES_MESSAGE; } FavoritesFeed.Articles.CollectionChanged += async(s, e) => { // This handles list saving for both newly-starred items and for // reordering of the Favorites list (which causes a Remove followed by an Add). // List saving for removals due to an unstarring are handled in FeedView.xaml.cs. if (e.Action == NotifyCollectionChangedAction.Add) { await SaveFavoritesAsync(); } FavoritesFeed.ErrorMessage = FavoritesFeed.Articles.Count > 0 ? null : NO_ARTICLES_MESSAGE; }; Initialized?.Invoke(this, EventArgs.Empty); }