domenica 2 marzo 2014

Windows Phone 8 - WriteableBitmap and app resume

When I upgraded my WP7 projects to Windows Phone 8, I discovered a strange behavior.

I usually update the tiles in the Application_Deactivated and Application_Closing event, but in wp8 the app crashes while it resumes.
The tiles were created in the storage, so all works good.

The problem seems related to the WriteableBitmap.Render method. I don't know why it blocks the UI thread!

If you have the same behavior, you can use a workaround:

In the App.xaml.cs add the Navigating event in the InitializePhoneApplication method
RootFrame.Navigating += RootFrame_Navigating;

Use the app://external/ string to know when you are exiting from the application
void RootFrame_Navigating(object sender, NavigatingCancelEventArgs e)
  // update my custom tiles

Nessun commento:

Posta un commento