public static async Task ClearOutTimeArticlesAsync(this FeedViewModel feedViewModel) { var original = feedViewModel.Articles; // 更新视图集合 var temp = feedViewModel.Articles.ToList(); temp.RemoveAll(x => x.UnRead == false && x.IsStarred == false); foreach (var item in temp) { feedViewModel.Articles.Remove(item); } var ClearArticles = from x in original where x.UnRead == false && x.IsStarred == false select x.AbstractInfo(); await SQLiteService.RemoveArticlesAsync(ClearArticles); }
/// <summary> /// Delete All the Related Articles in DataBases. /// </summary> public static async Task RemoveRelatedArticlesAsync(this FeedViewModel feedViewModel) { await SQLiteService.RemoveArticlesAsync(feedViewModel.Articles.Select(article => article.AbstractInfo())); feedViewModel.Articles.Clear(); }