【发布时间】:2013-04-18 13:58:59
【问题描述】:
我有一个 Windows Phone 8 应用程序和一些额外功能,只能与完整版一起使用。
所以用户点击了一个按钮
if ((Application.Current as App).IsTrial)
{
Buy()
}
else
{
//full feature
}
private void Buy()
{
MarketplaceDetailTask marketplaceDetailTask = new MarketplaceDetailTask();
marketplaceDetailTask.ContentType = MarketplaceContentType.Applications;
marketplaceDetailTask.ContentIdentifier = "82a23635-5bd9-df11-a844-00237de2db9e";
marketplaceDetailTask.Show();
}
- 这就是我所要做的吗?
- 当用户购买应用时,IsTrial 会自动设置为 false 吗?
- 如果我什至不知道 ContentIdentifier,我该如何更改 现在我的应用的标识符?
- 我可以在将应用放入商店之前更改 ContentIdentifier 吗?
App.xaml
/// <summary>
/// The LicenseInformation class enables an application to determine
/// if it is running under a trial license.
/// </summary>
private static LicenseInformation _licenseInfo = new LicenseInformation();
/// <summary>
/// This property is used to cache the license information while the application is running.
/// The application uses the property whenever the current license information needs to be checked.
/// </summary>
private static bool _isTrial = true;
public bool IsTrial
{
get
{
return _isTrial;
}
}
/// <summary>
/// Check the current license information for this application
/// </summary>
private void CheckLicense()
{
_isTrial = _licenseInfo.IsTrial();
}
【问题讨论】:
-
你测试过你的代码吗?
-
一切正常。但我的意思是如果我将我的应用程序放在应用程序商店中,当用户购买应用程序时,IsTrial 会自动设置为活动吗?我无法将 '(Application.Current as App).IsTrial' 设置为 true,因为它是 ReadOnly。
-
有一些方法可以通过模拟购买来测试此代码。我建议你这样做。
-
您在这篇文章中提出了 4 个问题。
标签: windows-phone-8 marketplace