저는 지금 가게에 넣고 싶은 Windows 8 App을 가지고 있습니다. 내가 '확인'을 클릭하면 IsActive를 'true'로 설정할 수는 없지만 AppSimulator는 정상적으로 작동합니다 ... 그러나 MsgDialog '감사'팝업이 표시됩니다. 그러나 CurrentApp가 올바른지 여부는 알 수 없습니다. IsActive는 코드에 할당하지 않고 자동으로 true로 설정된다는 것을 이미 읽었습니다.Windows 8 라이센스 정보
CurrentApp의 코드가 작동합니다
난 그냥 아래의 코드에 관한 두 가지 질문이 있습니까?
CurrentApp는 WindowsStoreProxy.xml에 아무 것도 지정하지 않으므로 Windows가이 정보를 저장소에서 자동으로로드하므로 (사실인지 여부는 알 수 없음) 어딘가에 읽었습니다.), WindowsStoreProxy.xml에서 ProductLicenses가 '프리미엄'이라고 어떻게 말 할 수 있습니까? 내부 애플리케이션 XML 파일 in-app-purchase.xml에서 가격/이름/...을로드하기 때문에 CurrentAppSimulator에서 쉽습니다. 그러나 실제 애플리케이션의 XML 파일을 설정하는 방법은 무엇입니까? Windows 스토어에서?
#if DEBUG
StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data");
StorageFile proxyFile = await proxyDataFolder.GetFileAsync("in-app-purchase.xml");
licenseChangeHandler = new LicenseChangedEventHandler(InAppPurchaseRefreshScenario);
CurrentAppSimulator.LicenseInformation.LicenseChanged += licenseChangeHandler;
await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);
#endif
#if DEBUG
LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;
ListingInformation productListing = await CurrentAppSimulator.LoadListingInformationAsync();
#else
LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
ListingInformation productListing = await CurrentApp.LoadListingInformationAsync();
#endif
ProductLicense productLicense = licenseInformation.ProductLicenses["Premium"];
if (!productLicense.IsActive)
{
Buy()
}
else
{
//use full function
}
private async void Buy()
{
#if DEBUG
LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;
#else
LicenseInformation licenseInformation = CurrentApp.LicenseInformation;
#endif
if (!licenseInformation.ProductLicenses["Premium"].IsActive)
{
try
{
#if DEBUG
await CurrentAppSimulator.RequestProductPurchaseAsync("Premium", false);
#else
await CurrentApp.RequestProductPurchaseAsync("Premium", false);
#endif
if (licenseInformation.ProductLicenses["Premium"].IsActive)
{
try
{
MessageDialog msgDialog = new MessageDialog("Thanks for buying the app.");
await msgDialog.ShowAsync();
}
catch
{
}
}
else
{
MessageDialog msgDialog = new MessageDialog("The purchase was cancelled.");
await msgDialog.ShowAsync();
}
}
catch
{
MessageDialog msgDialog = new MessageDialog("Connection error.");
msgDialog.ShowAsync();
}
}
else
{
MessageDialog msgDialog = new MessageDialog("You already have this feature.");
await msgDialog.ShowAsync();
}
}