Windows Phone: calling Async method on OnNavigatedTo

In my WP8 application, I want to call the Async method when the page moves.

I was thinking about marking the OnNavigatedTo method with the async keyword :

async protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); await myAsyncMethod(); } 

Is there a better approach to achieve this, is there a problem with marking OnNavigatedTo with asynchronous?

+6
source share
1 answer

No, that’s exactly what you should do. Mark OnNavigatedTo async, and then do everything you need to complete.

+7
source

All Articles