我有一个 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 吗?
应用程序.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();
}