Home > Metro, Windows 8 > Windows 8 Advanced Tile & Badge Topics

Windows 8 Advanced Tile & Badge Topics

Scheduled TileNotification

Tile data can not only be marked with an expiration date, it’s also possible to attach a timestamp for the first display. For this the class ScheduledTileNotification must be used instead of TileNotification.

Creation of a ScheduledTileNotification needs the same xmlData as with TileNotification, but allows to attach the timestamp for the initial display.

As with TileNotication, it is also possible to attach an expiry timestamp.
Then instead of calling .Update() the AddToSchedule() method must be called

Example:

ScheduledTileNotification scheduledTileNotification =
new ScheduledTileNotification(xmlDoc, deliveryTime);


scheduledTileNotification.ExpirationTime =
new DateTimeOffset(DateTime.Now.AddSeconds(35)); // Get a TileUpdater and perform the update TileUpdater tileUpdater = TileUpdateManager.CreateTileUpdaterForApplication(); tileUpdater.AddToSchedule(scheduledTileNotification);

 

Note: A maximum of 4096 notifications can be scheduled

Clearing and removing notifications:

Scheduled notifications can be removed and retrieved using GetScheduledTileNotifications() and RemoveFromSchedule()

 

Periodic Tile Notification

Update of tile data can also be automated to the system, which then fetches the data periodically from a source in the internet. The uri must return data in one of predefined XML-formats, where the placeholders are already filled with real data.

Example data:

<tile>
  <visual>
    <binding template="TileSquareBlock">
      <text id="1">Head</text>
      <text id="2">Data from Internet: 14:42:00: detail</text>
    </binding>
  </visual>
</tile>

Example code:

TileUpdater tileUpdater = 
TileUpdateManager.CreateTileUpdaterForApplication();
tileUpdater.StartPeriodicUpdate(
new Uri(http://www.stanglmayr.de/TileData.xml),
PeriodicUpdateRecurrence.HalfHour);

 

There is also an option to provide a timestamp for the initial start and the refreshinterval can be one of the following options:



image

 

.StopPeriodicUpdate() will stop the automatic refresh.

 

 

Periodic Badge Notification

The same methode can be used for fetching badge data from any internet source, whioch must provide the data in any of this predefined formats:

Example data:

<badge value="95"/>


Example code:

BadgeUpdater badgeUpdater = 
BadgeUpdateManager.CreateBadgeUpdaterForApplication(); badgeUpdater.StartPeriodicUpdate(
new Uri(http://www.stanglmayr.de/BadgeData.xml),
PeriodicUpdateRecurrence.HalfHour);

Categories: Metro, Windows 8
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: