Currently I’m executing db queries this way:
_svc = new Service1Client();
_svc.GetStateCompleted += new EventHandler<GetStateCompletedEventArgs>(_svc_GetStateCompleted);
private void _svc_GetStateCompleted(object sender, userdetCompletedEventArgs e)
{
//some code
}
Calling the query function,
_svc.GetStateAsync(args);
//more code
Is there anyway I can wait after GetStateAsync till the service function returns a value?
Typically you do not wait for a long running operation to complete. There are ways to achieve that, but normally if you do not want users to interact with the application until it completes – you disable all inputs and show some sort of a progress indicator until the operation completes.