问题
Does anybody know how can I recognize when is the app first launched? I need to show message dialog only at the first start after install. Thanks...
回答1:
You can use IsolatedStorageSettings
and check for a flag.
var settings = IsolatedStorageSettings.ApplicationSettings;
if (!settings.Contains("WasLaunched")) {
MessageBox.Show("First time to launch");
settings.Add("WasLaunched", true);
}
Note that re-deploying your app will reset the flag since its just a file saved in Isolated Storage but this should work if you launch your app from within emulator/actual device.
来源:https://stackoverflow.com/questions/16508968/recognize-when-is-the-app-first-launched-wp8