c# - Whats the best/safest way to run an async method on pageload? -


i have async method loads data disk (using json).

however, when run method in startuppage() or onnavigatedto() can't use await operator these aren't async methods. code still run, warnings isn't 'awaited'.

is there way of running async method on startup/navigatedto?

you need use async on onnavigatedto() avoid warning ..

protected override async void onnavigatedto(navigationeventargs e) {     try     {         if (!app.viewmodel.isdataloaded)         {             await app.viewmodel.loaddata();         }     }     catch (exception ex)     {         ...     } } 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -