Action Center In Universal Windows Apps

Action Center is a system area, where a user can have a settings panel (composite of several system settings) and notifications list, grouped by app, and ordered chronologically inside Action Center.

These are the notifications a user has missed or ignored  after swiping left to right on it.

User can access action center,

  1. Mobile : Swiping down from top edge of the screen.
  2. Desktop : Swiping left from right edge of the screen.

App can have a maximum of 20 notifications in their group. It follows the Queue format, and the last element is flushed out, once a new notification is pushed into the group.

Ideally an expiration date for a notification in the action center is 7 days, unless an earlier expiration time is specified during the creation of the toast.

Desktop

Desktop

Mobile

Mobile

There are various Action Center Management APIs available.

We can:

Remove one or many notifications.
Tag and group the notifications.
Replace a notification with a new one.
Set an expiration on the notifications.
Send "Ghost Toast" notifications (only show up in the notification center)

  1. void RemoveNotificationHistory()  
  2. {  
  3.     ToastNotificationHistory tH = ToastNotificationManager.History;  
  4.     tH.Remove("My App toast 1");  
  5.     tH.RemoveGroup("Whatsapp");  
  6. }  
App responsibilities on notification

Apps can inform the user of 'unread' items in ways(Count on tile, listed in Action Center).

App+Action Center+Tile(s) must tell a consistent story for a good experience.

 

  • User taps on toast popup or in Action center>App opens at the corresponding item
  • User opens app and reads unread items>Notification in Action Center are removed
  • User dismisses Action Center Notification>Tile badge count changes

ToastNotificationHistoryChangesTrigger-Fires, whenever a user dismisses a notification from an Action Center or when an app adds or removes or replaces a notification.

Use to trigger a Background task, in which you can maintain consistency of un-actioned item counts in app state and on tiles.

  1. public sealed class ActionCenterChangedTask: IBackgroundTask  
  2. {  
  3.     public void Run(IBackgroundTaskInstance taskInstance)   
  4.     {  
  5.         var toastNotifications = ToastNotificationManager.History.GetHistory();  
  6.         if (toastNotifications != null)   
  7.         {  
  8.             var toastCount = toastNotifications.Count;  
  9.             if (toastCount == 0)   
  10.             {  
  11.                 BadgeUpdateManager.CreateBadgeUpdaterForApplication().Clear();  
  12.             } else   
  13.             {  
  14.                 XmlDocument xmlBadge = BadgeUpdateManager.GetTemplateContent(BadgeTemplateType.BadgeNumber);  
  15.                 XmlElement badgeElement = (XmlElement) xmlBadge.SelectSingleNode("/badge");  
  16.                 badgeElement.SetAttribute("value", toastCount.ToString());  
  17.                 BadgeNotification badgeNotification = newBadgeNotification(xmlBadge);  
  18.                 BadgeUpdateManager.CreateBadgeUpdaterForApplication().Update(badgeNotification);  
  19.             }  
  20.         }  
  21.     }