我有一個Windows Phone 8應用程序和一些額外的功能,只能用於完整版本。Windows Phone 8 IsTrial Marketplace
所以上的按鈕
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。 – Rudi
有辦法通過嘲笑購買來測試此代碼。我建議你這樣做。 –