Aplicativos do Windows
Recolher sumário
Expandir sumário
EN
Este conteúdo não está disponível em seu idioma, mas aqui está a versão em inglês.

CurrentAppSimulator class

Defines methods and properties used to instantiate an object that you can use to get simulated license info during testing. You must replace the CurrentAppSimulator class with the CurrentApp class before you submit the app to the Windows Store. Apps that use the CurrentAppSimulator will fail certification. For more information about using this class, see the remarks section.

Note  If your app targets Windows 10, version 1607 or later, we recommend that you use members of the Windows.Services.Store namespace instead of the Windows.ApplicationModel.Store namespace. The Windows.Services.Store namespace supports the latest add-on types, such as Store-managed consumable add-ons, and is designed to be compatible with future types of products and features supported by Windows Dev Center and the Store. The Windows.Services.Store namespace is also designed to have better performance. For more information, see In-app purchases and trials.
 

Syntax


var currentAppSimulator = Windows.ApplicationModel.Store.CurrentAppSimulator;

Members

The CurrentAppSimulator class has these types of members:

Methods

The CurrentAppSimulator class has these methods. With C#, Visual Basic, and C++, it also inherits methods from the Object class.

MethodDescription
GetAppPurchaseCampaignIdAsync Retrieves the promotion campaign ID for the current app.
GetAppReceiptAsync Creates the async operation that the user can use to simulate requesting all receipts for this app and any in-app product purchases. For examples of how receipt information can be used, see Using receipts to verify product purchases.
GetProductReceiptAsync Creates the async operation that the user can use to simulate requesting the receipt for the specified product ID. For examples of how receipt information can be used, see Using receipts to verify product purchases.
GetUnfulfilledConsumablesAsync Returns a list of purchased consumable in-app products that have not been fulfilled locally.
LoadListingInformationAsync Loads the simulated app listing information asynchronously. Implements the IAsyncInfo interface.
LoadListingInformationByKeywordsAsync Windows Phone only. Loads the simulated app listing information asynchronously, returning in-app products in the ProductListings collection that match all supplied keywords. Implements the IAsyncInfo interface.
LoadListingInformationByProductIdsAsync Windows Phone only. Loads the simulated app listing information asynchronously, returning available in-app products in the ProductListings collection that match any of the given products IDs. This method implements the IAsyncInfo interface.
ReloadSimulatorAsync Reloads the simulator using a StorageFile containing the WindowsStoreProxy.xml file.
ReportConsumableFulfillmentAsync Simulates notifying the Windows Store that the purchase of a consumable in-app product is fulfilled and that the user has the right to access the content.
RequestAppPurchaseAsync Creates the async operation that simulates a user request to buy a full license for the current app.
RequestProductPurchaseAsync(String) Creates the async operation that displays the UI that is used to simulate the purchase of in-app product from the Windows Store.
RequestProductPurchaseAsync(String,Boolean) Creates the async operation that displays the UI that is used to simulate the purchase of an in-app product from the Windows Store.
RequestProductPurchaseAsync(String,String,ProductPurchaseDisplayProperties) Creates the async operation that displays the UI that is used to simulate the purchase of an in-app product from the Windows Store.

 

Properties

The CurrentAppSimulator class has these properties.

PropertyAccess typeDescription

AppId

Read-only

Gets a simulated app ID. Since CurrentAppSimulator is intended only for testing during app development, the returned CurrentAppSimulator.AppId will contain only 0's.

LicenseInformation

Read-only

Gets the simulated license metadata for the current app as provided by the simulation.

LinkUri

Read-only

Gets the simulated Uniform Resource Identifier (URI) that represents a Windows Store listing page for the current app.

 

Remarks

Until the app has been listed in the Windows Store, the CurrentApp object won't work in the app. Use the CurrentAppSimulator to test your app's licensing and in-app products while you develop your app. After you test your app, and before you submit it to the Windows Store, you must replace the instances of CurrentAppSimulator with CurrentApp. Your app will fail certification if it uses CurrentAppSimulator.

When the CurrentAppSimulator is used, the initial licensing state of the app is described in a file named WindowsStoreProxy.xml. CurrentAppSimulator methods that alter the license state, for example by buying a license or handling an in-app purchase, only update the license state of the object in memory. The contents of WindowsStoreProxy.xml are not changed. When the app starts again, the license state reverts to what is described in WindowsStoreProxy.xml.

For more information about the WindowsStoreProxy.xml file, see Using the WindowsStoreProxy.xml file with CurrentAppSimulator.

Requirements (Windows 10 device family)

Device family

Universal, introduced version 10.0.10240.0

API contract

Windows.Foundation.UniversalApiContract, introduced version 1.0

Namespace

Windows.ApplicationModel.Store
Windows::ApplicationModel::Store [C++]

Metadata

Windows.Foundation.UniversalApiContract.winmd

Requirements (Windows 8.x and Windows Phone 8.x)

Minimum supported client

Windows 8 [Windows Store apps only]

Minimum supported server

Windows Server 2012 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1 [Windows Runtime apps only]

Namespace

Windows.ApplicationModel.Store
Windows::ApplicationModel::Store [C++]

Metadata

Windows.winmd

Attributes

[MarshalingBehavior(Agile)]
[Threading(Both)]
[Version(0x06020000)]

See also

Object
Store sample (UWP)
Trial app and in-app purchase sample (Windows 8.1)

 

 

Mostrar:
© 2017 Microsoft