在SL程序的lauch 和 active 时调用
using Microsoft.Phone.Marketplace;
LicenseInformation _licenseInformation = new LicenseInformation();
bool _isTrial = _licenseInformation.IsTrial();
XNA中
用 Guide.IsTrialMode判断是否使用模式。
用下面代码测试
#if DEBUG
Guide.SimulateTrialMode = true;
#endif
用下面代码进入marketplace
Guide.ShowMarketplace(PlayerIndex.One);
用下面代码提示购买完整版
// MessageBox will have "OK" and "Cancel" buttons
List<String> mbList = new List<string>();
mbList.Add("OK");
mbList.Add("Cancel");
// BeginShowMessageBox is asynchronous. We define the method PromptPurchase as the callback
Guide.BeginShowMessageBox("Level 1 Complete", "Click OK to buy the game.", mbList, 0,
MessageBoxIcon.None, PromptPurchase, null);
private void PromptPurchase(IAsyncResult ar)
{
// Complete the ShowMessageBox operation and get the index of the button that was clicked.
int? result = Guide.EndShowMessageBox(ar);
// Clicked "OK", so bring the user to the application's marketplace page to buy the application.
if (result.HasValue && result == 0)
{
Guide.ShowMarketplace(PlayerIndex.One);
}
else
{
// User did not want to go to the marketplace to buy the application.
// stay at level one.
ResetGameCounters();
}
// Resume the game if it had been paused.
if (paused || pausedForGuide)
EndPause();
}