In my WP8 app, I want to call an Async method when the page is navigated to.
I thought about marking the OnNavigatedTo method with async keyword to be like this:
async protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
await myAsyncMethod();
}
is there a better approach to achieve this, is there a problem in labeling OnNavigatedTo with async ?
Nope this is exactly what you should be doing. Mark OnNavigatedTo as async and then execute whatever you need to execute.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With