C# 如何在Windows Phone中正确实现试用体验

C# 如何在Windows Phone中正确实现试用体验,c#,windows-phone-8,C#,Windows Phone 8,我已在我的应用程序中设置,以便在应用程序启动和激活时按照此处的指示查询许可证信息.IsTrial。我的主要问题是,在发布模式下调用CheckLicense返回\u isTrial=\u licenseInfo.isTrial()时,如果用户没有活动连接(比如说他们当前所在的位置没有蜂窝服务),那么应用程序会崩溃吗?我主要担心的是,每次激活或启动应用程序时都会调用此函数,因此为了防止应用程序崩溃,我是否需要将当前试用状态存储在隔离存储中?文件对此不清楚,我也没有找到任何其他地方说明在这种情况下该怎

我已在我的应用程序中设置,以便在应用程序启动和激活时按照此处的指示查询
许可证信息.IsTrial
。我的主要问题是,在发布模式下调用
CheckLicense
返回
\u isTrial=\u licenseInfo.isTrial()
时,如果用户没有活动连接(比如说他们当前所在的位置没有蜂窝服务),那么应用程序会崩溃吗?我主要担心的是,每次激活或启动应用程序时都会调用此函数,因此为了防止应用程序崩溃,我是否需要将当前试用状态存储在隔离存储中?文件对此不清楚,我也没有找到任何其他地方说明在这种情况下该怎么办

App.xaml.cs

private static LicenseInformation _licenseInfo = new LicenseInformaItion();


    private static bool _isTrial = true;
    public bool IsTrial
    {
        get
        {
            return _isTrial;
        }
    }


    /// <summary>
    /// Check the current license information for this application
    /// </summary>
    private void CheckLicense()
    {
        // When debugging, we want to simulate a trial mode experience. The following conditional allows us to set the _isTrial 
        // property to simulate trial mode being on or off. 
#if DEBUG
        string message = "This sample demonstrates the implementation of a trial mode in an application." +
                           "Press 'OK' to simulate trial mode. Press 'Cancel' to run the application in normal mode.";
        if (MessageBox.Show(message, "Debug Trial",
             MessageBoxButton.OKCancel) == MessageBoxResult.OK)
        {
            _isTrial = true;
        }
        else
        {
            _isTrial = false;
        }
#else
        _isTrial = _licenseInfo.IsTrial();
#endif
    }


    private void Application_Launching(object sender, LaunchingEventArgs e)
    {
        CheckLicense();
    }


    private void Application_Activated(object sender, ActivatedEventArgs e)
    {
        CheckLicense();
    }
private static LicenseInformation\u licenseInfo=new LicenseInformation();
私有静态bool_isTrial=true;
公共图书馆
{
得到
{
返回(isTrial);
}
}
/// 
///检查此应用程序的当前许可证信息
/// 
私有无效检查许可证()
{
//调试时,我们希望模拟试用模式体验
//属性来模拟正在打开或关闭的试用模式。
#如果调试
string message=“此示例演示应用程序中试用模式的实现。”+
“按“确定”模拟试用模式。按“取消”以正常模式运行应用程序。”;
if(MessageBox.Show)(消息“调试试用”,
MessageBoxButton.OK取消)==MessageBoxResult.OK)
{
_isTrial=true;
}
其他的
{
_isTrial=假;
}
#否则
_isTrial=_licenseInfo.isTrial();
#恩迪夫
}
私有void应用程序\u启动(对象发送方,启动事件参数e)
{
CheckLicense();
}
私有无效应用程序\u已激活(对象发送器,激活的事件目标)
{
CheckLicense();
}

否,如果您没有任何internet连接,应用程序不会崩溃。这是因为许可证嵌入了应用程序本身,因此也可以在脱机模式下访问。证明这一点的另一件事是,当你购买提供试用选项的应用程序的完整版本时,即使没有互联网连接,该应用程序也会知道它在“完整”模式下运行


你唯一不能做的就是在离线模式下购买应用程序。请注意,您的应用程序不会崩溃,您只会收到一个商店错误。

谢谢,这正是我想要的答案。除了在T减去3分钟的时间限制之外!