/// <summary> /// Run the background task /// </summary> /// <param name="taskInstance">Returns task informations</param> public async void Run(IBackgroundTaskInstance taskInstance) { BackgroundTaskDeferral deferral = taskInstance.GetDeferral(); try { ToastManager manager = new ShowToastManager(); await manager.CheckAndDisplayAsync(); } finally { // Informs the system task is finished deferral.Complete(); } }
/// <summary> /// Create the application tile /// </summary> /// <param name="task">Informations about the periodic task</param> protected override async void OnInvoke(ScheduledTask task) { try { // Update application tile ApplicationTileManager appTileManager = new ApplicationTileManager(); await appTileManager.UpdateAsync(); // Display toast notification if a new element has been published ToastManager manager = new NewsToastManager(); await manager.CheckAndToastAsync(); manager = new ConferenceToastManager(); await manager.CheckAndToastAsync(); manager = new ShowToastManager(); await manager.CheckAndToastAsync(); } finally { NotifyComplete(); } }