检测应用程序首先启动Windows Phone [英] Detect app first launch windows phone

查看:27
本文介绍了检测应用程序首先启动Windows Phone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 Windows Phone 开发人员很陌生.我想检测用户何时首次启动我的应用程序以显示解释框架,例如调用:

I'm quite new on windows phone dev. I would like to detect when the user launches my app for the first time to display an explaination frame for example by calling :

if(firstLaunch)
showTheFrameToTheGuyBecauseHeLaunchedTheAppForTheFirstTime();

如果有人能向我们展示这么小的脚本,我会非常高兴......

I would be sooooooo glad if someone could show us such a small script...

提前谢谢你们!

推荐答案

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

I would recommend you to use the builtin applicationsettings.

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 文档可用 此处.

Microsoft Documentation about Settings in Windows Phone is available here.

这篇关于检测应用程序首先启动Windows Phone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆