comentsys.wordpress.com today features a Universal Windows Platform tutorial showing how to use Badges, these are small notifications that appear on the icon for an application either on the task bar or pinned tile.
Details
There’s a list of string for the glyphs supported by a Badge, then a Dialog method that has a ComboBox set to those “glyphs” and a TextBox where a number can be entered between 1 and 99 and returns the entered value as a string. The UpdateBadge method takes a string and checks if this is numeric then gets the template for either BadgeNumber or BadgeGlyph based on this value then the “value” is set to the passed in value and a BadgeNotification created from this and passed to the Update method of the BadgeUpdateManager with CreateBadgeUpdaterForApplication.
The PinAsync method determines if the application is pinned to start with the GetAppListEntriesAsync from the Package.Current with ContainsAppListEntryAsync from the StartScreenManager.GetDefault method and if not uses the RequestAddAppListEntryAsync to pin the application to start. The Badge method uses the Dialog method to get the value to use on a Badge and uses the UpdateBadge method with the “result” of the the Dialog.
Behind the Scenes
Badges show how easy it is to use this kind of notification – the majority of examples for this tended to be in Javascript mostly but this shows how straightforward it is to do it from C# instead and the example is based from the official documentation for updated Badges.