I've setup a DispatcherTimer that calls a WCF service on each tick event. After the service is called I'd like to update the UI without blocking it, so I've marked both the event handler for the timer and the method that makes the WCF call as async and included await commands in the relevant places (see code below). However, the UI is still getting blocked. Any ideas?
static async void connectivityTimer_Tick(object sender, EventArgs e)
{
Person person = await ServiceClient.GetPersonAsync();
lblText.Text = person.Name;
}
public static async Task<Person> GetPersonAsync()
{
Service.Client client = new Service.Client();
Task<string> serviceResult = client.GetPersonAsync();
string contentResults = await serviceResult;
XmlSerializer serializer = new XmlSerializer(typeof(PersonContainer));
using (TextReader reader = new StringReader(contentResults))
{
return ((PersonContainer)serializer.Deserialize(reader)).Person;
}
}