I’m trying to figure out how can I make sure that the event has fired before letting the rest of the code run.
I hook up an event like this:
public stati
The async/await is designed to solve your particular set of problems.
You'll need to turn the WCF calls into Tasks. Then it is a matter of
public static async void QueryUrlParameters()
{
await dynMapServLayer.EnsureIsInitialized();
Query query = GetParameterQuery();
QueryTask queryTask = new QueryTask(GetRestURL(dynMapServLayer));
var result = await queryTask.ExecuteAsync(query);
// etc ....
}
Update:
On VS2010, you can either using Async CTP or use this syntax http://msdn.microsoft.com/en-us/vstudio/hh533273.aspx
initializationTask.ContinueWith(()=> ...)
It is best to try this with a test project first.