Category Archives: Windows 8

Windows 8.1 File API Improvements

For anyone that has been wondering what I’ve been doing in the past year, I’ve been working on some cool improvements for the WinRT File API. Yesterday the preliminary documentation was released and my awesome teammate Marc gave a talk at Build about the improvements, including API improvements, the new StorageLibrary API, and the integration with SkyDrive. The Build talk and a few more links are below.

Build Talk (video & slides)

MSDN documentation

Windows App Builder Blog post

Download Windows 8.1 Preview and try it yourself!

Updating the badge in a Windows 8 JavaScript App

Windows 8 apps can have notification badges in the tiles. It’s easy to update the badge, but it’s still not well documented, so here is a small snippet to show you how it’s done:

var Notifications = Windows.UI.Notifications;
var updater = Notifications.BadgeUpdateManager.createBadgeUpdaterForApplication();
var xml = Notifications.BadgeUpdateManager.getTemplateContent(
    Notifications.BadgeTemplateType.badgeNumber
);

xml.getElementsByTagName('badge')[0].setAttribute('value', 5);

var notification = Notifications.BadgeNotification(xml);
updater.update(notification);

Replace the 5 in line 7 with the number of your choice. The end result looks like this:

Badge update example

More info on badge updates is available in the Windows.UI.Notifications namespace of the WinRT and the Badge Update XML Schema.