Note: RequestAppPurchaseAsync is an asynchronous method. To determine whether the purchase was carried out, you handle LicenseChanged events. You’re not handling those events here because you’re already handling them in AppLicenseDataSource.cs. When a LicenseChanged event fires, the handler verifies that the app is no longer a trial version and fires PropertyChanged events to update controls bound to IsTrial and other AppLicenseDataSource properties. Task 2 – Purchase the App Pretty simple, huh? Now let’s simulate an app purchase. Be aware that CurrentAppSimulator stores information regarding purchases and changes in licensing status in memory; it doesn’t record them in WindowsStoreProxy.xml. Therefore, once you purchase the app, it will remain “purchased” as long as the app is running, but when you restart the app, you’ll once more be running a trial version. Press F5 to launch the application. Go to the about page and tap the purchase button to simulate an app purchase. Complete the simulated purchase by tapping the Continue button in the Windows Store dialog. Display the about page again and confirm that the purchase button has disappeared. Note: Contoso Cookbook doesn’t expose additional functionality to the user once it has been purchased; it merely replaces the purchase button with licensing information. In real life, you might choose to limit what the user can do with a trial version and only expose the full functionality once a purchase has been made. Return to Visual Studio and stop debugging. In addition to allowing , the Windows Store supports in-app product purchases, too. For example, a game program could allow users to purchase additional levels of the game as they complete previous levels. In Windows Store , features purchased this way are known as products, and the Windows Runtime provides the APIs you need for product purchases, as well as APIs for determining which products have been purchased, the licensing status of those products, and more. In this exercise, youll modify Contoso Cookbook so that Italian recipes are no longer free, but must be purchased. Youll add a simple UI for purchasing them that relies on CurrentAppSimulator, and logic that prevents Italian recipes from being shown in full until after a product purchase has been made.
Note: RequestAppPurchaseAsync is an asynchronous method. To determine whether the purchase was carried out, you handle LicenseChanged events. You’re not handling those events here because you’re already handling them in AppLicenseDataSource.cs. When a LicenseChanged event fires, the handler verifies that the app is no longer a trial version and fires PropertyChanged events to update controls bound to IsTrial and other AppLicenseDataSource properties. Task 2 – Purchase the App Pretty simple, huh? Now let’s simulate an app purchase. Be aware that CurrentAppSimulator stores information regarding purchases and changes in licensing status in memory; it doesn’t record them in WindowsStoreProxy.xml. Therefore, once you purchase the app, it will remain “purchased” as long as the app is running, but when you restart the app, you’ll once more be running a trial version. Press F5 to launch the application. Go to the about page and tap the purchase button to simulate an app purchase. Complete the simulated purchase by tapping the Continue button in the Windows Store dialog. Display the about page again and confirm that the purchase button has disappeared. Note: Contoso Cookbook doesn’t expose additional functionality to the user once it has been purchased; it merely replaces the purchase button with licensing information. In real life, you might choose to limit what the user can do with a trial version and only expose the full functionality once a purchase has been made. Return to Visual Studio and stop debugging. In addition to allowing , the Windows Store supports in-app product purchases, too. For example, a game program could allow users to purchase additional levels of the game as they complete previous levels. In Windows Store , features purchased this way are known as products, and the Windows Runtime provides the APIs you need for product purchases, as well as APIs for determining which products have been purchased, the licensing status of those products, and more. In this exercise, youll modify Contoso Cookbook so that Italian recipes are no longer free, but must be purchased. Youll add a simple UI for purchasing them that relies on CurrentAppSimulator, and logic that prevents Italian recipes from being shown in full until after a product purchase has been made.
4578.Lab-8_242832A0.docx