/// <summary> /// 后台任务 提示头条文章信息 /// </summary> /// <returns></returns> public async static Task UpdateTopStories() { APIService api = new APIService(); var t = await api.GetLatestStories(true); if (t != null) { UpdateTile(t); UpdateBadge(t); ShowToast(t); } }
public async static Task PullLatestStories() { APIService api = new APIService(); var t = await api.GetLatestStories(); }
/// <summary> /// 拉取最新文章 /// </summary> /// <returns></returns> public async static Task PullLatestStories() { APIService api = new APIService(); var t = await api.GetLatestStories(); //将当天未读文章更新到 badge int un_readed = 0; t.Stories.ToList().ForEach(s => { if (!DataShareManager.Current.ReadedList.Contains(s.ID)) un_readed++; }); var updater = BadgeUpdateManager.CreateBadgeUpdaterForApplication(); if (un_readed != 0) { var badgexml = new BadgeNumericNotificationContent((uint)un_readed); var n = badgexml.CreateNotification(); n.ExpirationTime = DateTime.Now.AddDays(7); updater.Update(n); } else { updater.Clear(); } }