CreateNotification() public method

Creates a WinRT BadgeNotification object based on the content.
public CreateNotification ( ) : BadgeNotification
return Windows.UI.Notifications.BadgeNotification
 private void showBadgeWithGlyph(object sender, RoutedEventArgs e)
 {
     BadgeGlyphNotificationContent badgeContent = new BadgeGlyphNotificationContent(GlyphValue.Playing);
     BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeContent.CreateNotification()); 
 }
Ejemplo n.º 2
0
        /// <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());
        }
        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
                       };
        }
Ejemplo n.º 4
0
        /// <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());
        }
Ejemplo n.º 5
0
        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 application’s tile.
            BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeContent.CreateNotification());

            OutputTextBlock.Text = badgeContent.GetContent();
        }