How can I periodically update (i.e. all 10s) a class in my ViewModel by call an async Webservice call in a Win 8.1 Universal app? I tried with a DispatcherTimer but the timer can't handle the async part. Here is my code i tried:
_myTimer = new DispatcherTimer();
_myTimer.Interval = new TimeSpan(0, 0, 10);
_myTimer.Tick += timerTick;
protected async Task timerTick(object sender, object e)
{
var handler = new HttpClientHandler();
var client = new System.Net.Http.HttpClient(handler);
string url = "url";
using (Stream stream = await client.GetStreamAsync(new Uri(url)))
{
}
}