Why does TileUpdater.Clear () remove all updates?

I'm going to schedule quite a few updates for the tile, and noticed that the .Clear () method does not seem to work. It should "Uninstall all updates and return its contents by default, as indicated in the application manifest" (MSDN)

EDIT: Cheeky MS! The documentation for this method says: "Note: this method does not stop periodic updates"

Let's say I'm planning 3000 updates (not what I will do btw!), After calling clear count another 3000 more.

enter image description here

The same question was asked here: TileUpdater.Clear () did not release the notification quota , and the only recommendation was to manually delete each and one of the updates.

I decided to check how long it took to use the StopWatch class, and it took a little more than 11 seconds, 18 seconds with the maximum number of scheduled updates on 4096, so the solution seems a little crazy.

enter image description here

Since I do not plan more than a few days ahead of the hour, and perhaps use the background task with a maintenance trigger to add new ones, I will be fine with the delete cycle. But I still hope that I am doing something wrong here and that there is a better solution.

So, you know why .Clear () does not work, and what would be the best alternative?

Here is the code if you want to try:

private void Button_Click_1(object sender, RoutedEventArgs e) { var updater = TileUpdateManager.CreateTileUpdaterForApplication(); updater.Clear(); var test = updater.GetScheduledTileNotifications(); var stopWatch = new Stopwatch(); stopWatch.Start(); foreach (var update in test) { updater.RemoveFromSchedule(update); } stopWatch.Stop(); var time = stopWatch.Elapsed; notify.Text = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", time.Hours, time.Minutes, time.Seconds, time.Milliseconds / 10); for (int i = 0; i < 4096; i++) { var wide = TileContentFactory.CreateTileWideText09(); var square = TileContentFactory.CreateTileSquareText04(); wide.TextHeading.Text = "The heading"; wide.TextBodyWrap.Text = "The body text for notification: " + i; square.TextBodyWrap.Text = "The body text for notification: " + i; wide.SquareContent = square; var tileNotification = new ScheduledTileNotification(wide.GetXml(), DateTime.Now.AddMinutes(i + 1)); updater.AddToSchedule(tileNotification); } } 
+6
source share
1 answer

iris,

Clear only clears the changes in the tile.

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.tileupdater.clear.aspx

StopPeriodicUpdate only cancels scheduled updates, but does not delete them. http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.tileupdater.stopperiodicupdate.aspx

Bottom line - no functionality. The documentation is not clear /.NET, for example, when Clear actually means Clear, not reset content . Sad state of affairs, but all that we have

+1
source

All Articles