/// <summary> /// 更新磁贴图标 /// </summary> /// <param name="number"></param> public static void UpdateBadgeWithGlyph(int index) { BadgeGlyphNotificationContent badgeContent = new BadgeGlyphNotificationContent((GlyphValue)index); // Send the notification to the application’s tile. BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeContent.CreateNotification()); }
public void SetBadgeGlyph(GlyphValue glyph) { BadgeGlyphNotificationContent badgeContent = new BadgeGlyphNotificationContent(glyph); BadgeNotification badgeNotification = new BadgeNotification(badgeContent.GetXml()); badgeNotification.ExpirationTime = DateTimeOffset.UtcNow.AddHours(1); BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeNotification); }
/// <summary> /// 更新磁贴图标 /// </summary> /// <param name="number"></param> public static void UpdateSecondaryBadgeWithGlyph(string tileId, int index) { BadgeGlyphNotificationContent badgeContent = new BadgeGlyphNotificationContent((GlyphValue)index); // Send the notification to the application’s tile. BadgeUpdateManager.CreateBadgeUpdaterForSecondaryTile(tileId).Update(badgeContent.CreateNotification()); }
void UpdateBadgeWithGlyph(int index) { // Note: This sample contains an additional project, NotificationsExtensions. // NotificationsExtensions exposes an object model for creating notifications, but you can also modify the xml // of the notification directly. See the additional function UpdateBadgeWithGlyphWithStringManipulation to see how to do it // by modifying strings directly // Note: usually this would be created with new BadgeGlyphNotificationContent(GlyphValue.Alert) or any of the values of GlyphValue BadgeGlyphNotificationContent badgeContent = new BadgeGlyphNotificationContent((GlyphValue)index); // send the notification to the app's application tile BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeContent.CreateNotification()); OutputTextBlock.Text = badgeContent.GetContent(); }
public async Task <GasQueryRefreshResult> RefreshAsync() { bool bExceptionInExecution = false; try { // Show activitiy var badgeContent = new BadgeGlyphNotificationContent(GlyphValue.Activity); BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeContent.CreateNotification()); // TODO: Work with roaming parameters as well as local results var existingResults = await LoadResultsAsync(); var taskList = new List <Task <GasQueryDownloadResult> >(); foreach (GasQueryResult current in existingResults) { var copyForClosure = current; var task = new Task <GasQueryDownloadResult>(() => CreateGasPriceInfoProxy().DownloadAsync(copyForClosure).Result); taskList.Add(task); task.Start(); } await Task.WhenAll(taskList); List <GasQueryResult> returnedResults = new List <GasQueryResult>(); var notify = CreateResultChangedNotification(); foreach (var current in taskList) { var downloadResult = current.Result; GasQueryResult currentResult = downloadResult.Result; if (downloadResult.Succeeded) { returnedResults.Add(currentResult); await notify.NotifyGasQueryResultChanged(currentResult); } else { // Keep the old information around instead var oldToReuse = existingResults.Single(r => r.UniqueId == currentResult.UniqueId); returnedResults.Add(oldToReuse); } } bool saveOk = await SaveResultsAsync(returnedResults); return(new GasQueryRefreshResult() { Succeeded = true, Results = returnedResults }); } catch (Exception) { bExceptionInExecution = false; } finally { BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear(); } return(new GasQueryRefreshResult() { Succeeded = false, Results = null }); }
void UpdateBadgeWithGlyph(GlyphValue index) { BadgeGlyphNotificationContent badgeContent = new BadgeGlyphNotificationContent(index); BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeContent.CreateNotification()); }
public static void CreateBadge(BadgeGlyphNotificationContent badge) { BadgeNotification b = new BadgeNotification(badge.GetXml()); BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(b); }