Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 77050

async Task in App constructor?

$
0
0

I need to set MainPage in the app depending on whether or not a settings file exists. The function in PCLStorage to check if a file exists is async though, so I can't call it directly in the App constructor. I tried just firing off a separate task to check if the file exists, and then set MainPage. It works some of the time, but other times, my app gets stuck on the splash screen. I've also tried just setting the MainPage to my main menu in the App constructor, and then firing off the task and changing to the Settings page if the settings file doesn't exist, but then it flashes the main menu first, and switches to settings, and I would prefer it doesn't do that. Is there some method I can use for checking if a file exists while in the App constructor, or a better way choose what I set MainPage too?


Viewing all articles
Browse latest Browse all 77050

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>