I am writing an application for the Windows 8 Store with Live Tiles. Each live tile is an image that needs to be updated every x minutes. I am using a background job with a time trigger to generate my image and update the slabs.
Creating my image involves creating a new one and drawing my stuff on it, but for some reason I get an exception when I try to create a new instance of WriteableBitmap:
var newImage = new Windows.UI.Xaml.Media.Imaging.WriteableBitmap(10, 10);
or
var newImage = BitmapFactory.New (10, 10);
throws this exception:
The application is called an interface that was a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))
I got the impression that this is due to the fact that there is no user interface thread in the background job, but again, why does the WriteableBitmap require a user interface thread?
Any idea how to do this? How to create an instance of WriteableBitmap in my background task?
source share