I am wondering how to signal whether an appication is launched for the very first time, or has already been launched before. The reason I want to do this is to show a very short informative message before the application is ever used, while every other time the application is launched nothing shows. Would I place something in App.xaml.cs like the following
var settings = IsolatedStorageSettings.ApplicationSettings;
if (!settings.Contains("WasLaunched"))
{
MessageBox.Show("First time to launch");
settings.Add("WasLaunched", true);
}
And if (!settings.Contains("WasLaunched")
navigate to the 'first launch page' as opposed to the 'main page'? Can someone point me to any good references on this implementation?
EDIT**
I changed my WMAppManifest.xml
default page to LaunchPage.xaml
<DefaultTask Name="_default" NavigationPage="LaunchPage.xaml" />
And created my UriMapper class
public class LoginUriMapper : UriMapperBase
{
public override Uri MapUri(Uri uri)
{
if (uri.OriginalString == "/LaunchPage.xaml")
{
if (Settings.FirstLoad.Value == true)
{
//Navigate to Welcome Page with quick first time user info
uri = new Uri("/Views/WelcomePage.xaml", UriKind.Relative);
}
else
{
///Navigate to the actual Main Page
uri = new Uri("/MainPage.xaml", UriKind.Relative);
}
}
return uri;
}
}
But how do I change App.xaml.cs accordingly
private void Application_Launching(object sender, LaunchingEventArgs e)
{
//how to check and navigate to correct page for this specific method?
}
private void Application_Activated(object sender, ActivatedEventArgs e)
{
//how to check and navigate to correct page for this specific method?
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…