Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/295.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#Windows应用商店inapp购买_C#_In App Purchase_Windows Store Apps - Fatal编程技术网

C#Windows应用商店inapp购买

C#Windows应用商店inapp购买,c#,in-app-purchase,windows-store-apps,C#,In App Purchase,Windows Store Apps,我正在尝试从此处复制此示例应用程序中的功能: 进入我正在编写的应用程序。我已经开始着手实现购买消耗品的功能 到目前为止我所做的: 1.)将函数体复制到我的“购买”按钮的事件处理程序中 2.)从工作示例中复制WindowsStoreProxy.xml以替换我的项目中的示例 3.)双重和三重检查试验模式是否为假 注: 不会打开gui以在我的项目代码中选择返回代码(在示例中确实如此)。将“product2”更改为“2”修复了该问题。但是,当等待的RequestProductPurchaseAsync返

我正在尝试从此处复制此示例应用程序中的功能:

进入我正在编写的应用程序。我已经开始着手实现购买消耗品的功能

到目前为止我所做的:

1.)将函数体复制到我的“购买”按钮的事件处理程序中

2.)从工作示例中复制WindowsStoreProxy.xml以替换我的项目中的示例

3.)双重和三重检查试验模式是否为假

注:

不会打开gui以在我的项目代码中选择返回代码(在示例中确实如此)。将“product2”更改为“2”修复了该问题。但是,当等待的RequestProductPurchaseAsync返回时,以下表达式:

    licenseInformation.ProductLicenses["2"].IsActive

当示例中说它应该为真时,仍然为假,因此我的代码永远不会成功。

是否正在将WindowsStoreProxy.xml读入模拟器

    StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); 
    StorageFile proxyFile = await proxyDataFolder.GetFileAsync("WindowsStoreProxy.xml"); 
    await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile); 

我的印象是,如果您使用的是驻留在“数据”文件夹中的副本,那么这是为您准备的。我使用的是C:\Users[username\AppData[packagename]\LocalState\Microsoft\Windows Store\ApiData中的一个,默认情况下应该加载。哦,我从来没有这样尝试过。但是文档还建议“虽然您可以修改此文件中的值,但建议您创建自己的WindowsStoreProxy.xml文件。”(在VS项目的一个数据文件夹中)供模拟器使用。”所以,不妨尝试一下。
    StorageFolder proxyDataFolder = await Package.Current.InstalledLocation.GetFolderAsync("data"); 
    StorageFile proxyFile = await proxyDataFolder.GetFileAsync("WindowsStoreProxy.xml"); 
    await CurrentAppSimulator.ReloadSimulatorAsync(proxyFile);