相关疑难解决方法(0)

如何在Windows 10应用程序中实施应用程序内购买?

我想在我的Windows通用应用程序中集成应用程序内购买.我在编码前做了以下事情.

  • Windows开发人员中心制作应用程序

  • 加入产品在单边行动计划部分细节,并提交到商店,你可以在看图片

  • 之后,我在我的应用程序中使用以下代码获取应用程序内购买产品列表和购买产品按钮.我也使用CurrentApp而不是CurrentAppSimulator在我的代码中,但它是异常的.
private async void RenderStoreItems()
    {
        picItems.Clear();

        try
        {
            //StoreManager mySM = new StoreManager();
            ListingInformation li = await CurrentAppSimulator.LoadListingInformationAsync();

            System.Diagnostics.Debug.WriteLine(li);

            foreach (string key in li.ProductListings.Keys)
            {
                ProductListing pListing = li.ProductListings[key];
                System.Diagnostics.Debug.WriteLine(key);

                string status = CurrentAppSimulator.LicenseInformation.ProductLicenses[key].IsActive ? "Purchased" : pListing.FormattedPrice;

                string imageLink = string.Empty;

                picItems.Add(
                    new ProductItem
                    {
                        imgLink = key.Equals("BaazarMagzine101") ? "block-ads.png" : "block-ads.png",
                        Name = pListing.Name,
                        Status = status,
                        key = key,
                        BuyNowButtonVisible = CurrentAppSimulator.LicenseInformation.ProductLicenses[key].IsActive ? false : true …
Run Code Online (Sandbox Code Playgroud)

.net c# windows-rt win-universal-app windows-10

8
推荐指数
1
解决办法
2784
查看次数

标签 统计

.net ×1

c# ×1

win-universal-app ×1

windows-10 ×1

windows-rt ×1