Reputation: 587
In a Silverlight Windows Phone 7 app, how can you organise the startup sequence so you can execute code AFTER the app has initalized and loaded (i.e., after the splash screen goes away and the app is visible)?
I have a main page constructor that looks like this:
public MainPage()
{
InitializeComponent();
loadSettings();
getLocation();
}
The getLocation()
function gets the phone's location with the GeoCoordinateWatcher
object. The initialisation of this can take up to a minute, and in this time the splash screen of the app is visible.
How can I organise the code so that the app is first initialized, THEN I can show a waiting screen of my own with more text saying "Getting Location" etc.?
Upvotes: 1
Views: 241
Reputation: 16319
You can add a handler for the Loaded event and then call loadSettings and getLocation. You might want to do this in a BackgroundWorker to keep things responsive.
Upvotes: 2