相关疑难解决方法(0)

如果首次启动应用程序,如何显示页面

我想知道如何表示是否第一次启动应用程序,或者之前已经启动了应用程序.我想这样做的原因是在使用应用程序之前显示非常简短的信息性消息,而每隔一次启动应用程序都没有显示.我会在App.xaml.cs中放置如下内容

var settings = IsolatedStorageSettings.ApplicationSettings;
if (!settings.Contains("WasLaunched")) 
{
  MessageBox.Show("First time to launch");
  settings.Add("WasLaunched", true);
}
Run Code Online (Sandbox Code Playgroud)

如果(!settings.Contains("WasLaunched")导航到"第一个启动页面"而不是"主页面"?有人能指出我对这个实现的任何好的参考?

编辑**

我将WMAppManifest.xml默认页面更改为LaunchPage.xaml

<DefaultTask Name="_default" NavigationPage="LaunchPage.xaml" />
Run Code Online (Sandbox Code Playgroud)

并创建了我的UriMapper类

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);
            } …
Run Code Online (Sandbox Code Playgroud)

c# windows-phone-7 windows-phone-8

1
推荐指数
1
解决办法
2514
查看次数

标签 统计

c# ×1

windows-phone-7 ×1

windows-phone-8 ×1