C# 检测应用程序首次启动windows phone

C# 检测应用程序首次启动windows phone,c#,visual-studio,windows-phone-8,C#,Visual Studio,Windows Phone 8,我是windows phone开发人员中的新手。我想检测用户何时首次启动我的应用程序以显示解释框,例如,通过调用: if(firstLaunch) showTheFrameToTheGuyBecauseHeLaunchedTheAppForTheFirstTime(); 如果有人能给我们看这么小的剧本,我会非常高兴 提前谢谢大家 您可以简单地使用隔离存储设置 if(!IsolatedStorageSettings.ApplicationSettings.Contains("first")) {

我是windows phone开发人员中的新手。我想检测用户何时首次启动我的应用程序以显示解释框,例如,通过调用:

if(firstLaunch)
showTheFrameToTheGuyBecauseHeLaunchedTheAppForTheFirstTime();
如果有人能给我们看这么小的剧本,我会非常高兴


提前谢谢大家

您可以简单地使用隔离存储设置

if(!IsolatedStorageSettings.ApplicationSettings.Contains("first"))
{
   // Do your stuff
   IsolatedStorageSettings.ApplicationSettings["first"] = true;
   IsolatedStorageSettings.ApplicationSettings.Save();
}

这段代码就可以了。

您可以简单地使用IsolatedStorage设置

if(!IsolatedStorageSettings.ApplicationSettings.Contains("first"))
{
   // Do your stuff
   IsolatedStorageSettings.ApplicationSettings["first"] = true;
   IsolatedStorageSettings.ApplicationSettings.Save();
}

这段代码就可以了。

我建议您使用内置的应用程序设置

const string settingsAppLaunched = "appLaunched";

public static bool IsFirstLaunch(){
    IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
    return !(settings.Contains(settingsAppLaunched) && settings[settingsAppLaunched]);
}

public static bool Launched(){
    if(IsFirstLaunch()){
        IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
        settings.Add(settingsAppLaunched, true);
        settings.Save();
    }
}

//usage:
if(IsFirstLaunch()){
    showTheFrameToTheGuyBecauseHeLaunchedTheAppForTheFirstTime();
    Launched();
} 

有关Windows Phone中设置的Microsoft文档可用。

我建议您使用内置应用程序设置

const string settingsAppLaunched = "appLaunched";

public static bool IsFirstLaunch(){
    IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
    return !(settings.Contains(settingsAppLaunched) && settings[settingsAppLaunched]);
}

public static bool Launched(){
    if(IsFirstLaunch()){
        IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;
        settings.Add(settingsAppLaunched, true);
        settings.Save();
    }
}

//usage:
if(IsFirstLaunch()){
    showTheFrameToTheGuyBecauseHeLaunchedTheAppForTheFirstTime();
    Launched();
} 

有关Windows Phone中设置的Microsoft文档可用。

这回答了我的问题,非常感谢。这回答了我的问题,非常感谢。此解决方案也有效。谢谢!这个解决方案也很有效,谢谢!