I recently started working window phone 7. I created a delegate and tried to call it asynchronously.
The code was something like this:
public class1
{
public delegate void fireAlwaysDelegate();
fireAlwaysDelegate fad;
public class1()
{
initializeComponents();
fad=new fireAlwaysDelegate(fireAlways)
}
fireAlways()
{
//some code
}
PhoneApplicationPage_loaded()
{
//some code
fda.beginInvoke(null,null);
}
}
But, when I executed this code, it threw an exception saying .net compact framework does not support invoking delegates asynchronously.
As per my understanding of WP7 framework it uses async calls for almost everything, so i am not able to understand why this is not permitted.
Any work around for this thing.
I wanted to execute some code once the PhoneApplicationPage_loaded is complete and UI is Launched, i thought of calling an async delegate from PhoneApplicationPage_loaded.
Also i will like to understand why async call to delegates is not permitted.
You can use BackgroundWorker instead.