As in the header, the event does not fire when the code is executed in the BackgroundAgent , while it works fine, when I execute it in the main application.
Here is my code:
var background = new BitmapImage(new Uri(uri), UriKind.Absolute)){ CreateOptions = BitmapCreateOptions.None }; background.ImageFailed += (s, e) => { Debug.WriteLine(e); // Nothing happens here so I guess that there no error in the image loading }; background.ImageOpened += (s, e) => { Debug.WriteLine("ImageOpened"); // This line is never printed no the event is never thrown };
Everthing runs on a Dispatcher stream, and I'm trying to load a remote image (I cannot cache it because it is a dynamic image generated on a php page).
Any clues?
EDIT:
Here's the code based on the @ l3arnon assumption:
var backgroundImage = new BitmapImage { CreateOptions = BitmapCreateOptions.None }; backgroundImage.ImageOpened += (s, e) => { Debug.WriteLine("ImageOpened"); }; backgroundImage.UriSource = new Uri(uri);
still no success.
c # events windows-phone-8 background-agents
StepTNT
source share