CurrentAppSimulator 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
定義用來具現化物件的方法和屬性,讓您可用來在測試期間取得仿真的授權資訊。
注意
CurrentAppSimulator 類別和 Windows.ApplicationModel.Store 命名空間中的其他類型不再使用新功能更新。 如果您的項目目標 Windows 10 年度版 (10.0;組建 14393) 或更新版本中的 Visual Studio(也就是,您是以 Windows 10 版本 1607 或更新版本為目標),建議您改用 Windows.Services.Store 命名空間。 如需詳細資訊,請參閱 應用程式內購買和試用版。 CurrentAppSimulator 類別不支援在 Windows 傳統型應用程式中使用 傳統型網橋,或在 合作夥伴中心 中使用開發沙箱的應用程式或遊戲中(例如,這是任何與 Xbox Live 整合的遊戲的情況)。 這些產品必須使用 Windows.Services.Store 命名空間來實作應用程式內購買和試用版。
public ref class CurrentAppSimulator abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class CurrentAppSimulator final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class CurrentAppSimulator
Public Class CurrentAppSimulator
- 繼承
- 屬性
Windows 需求
| 規格需求 | Description |
|---|---|
| 裝置系列 |
Windows 10 (已於 10.0.10240.0 引進)
|
| API contract |
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)
|
備註
在應用程式列在 Microsoft Store 之前,CurrentApp 物件將無法在應用程式中運作。 當您開發應用程式時,請使用 CurrentAppSimulator 來測試應用程式的授權和應用程式內產品。 測試應用程式之後,以及提交至 Microsoft 市集之前,您必須將 CurrentAppSimulator 的實例取代為 CurrentApp。 如果您的應用程式使用 CurrentAppSimulator,則認證將會失敗。
使用 CurrentAppSimulator 時,應用程式的初始授權狀態會在名為 WindowsStoreProxy.xml的檔案中描述。 CurrentAppSimulator 方法可改變授權狀態,例如購買授權或處理應用程式內購買,只會更新記憶體中對象的授權狀態。 WindowsStoreProxy.xml 的內容不會變更。 當應用程式再次啟動時,授權狀態會還原為 WindowsStoreProxy.xml中所述的內容。
如需 WindowsStoreProxy.xml 檔案的詳細資訊,請參閱 使用 WindowsStoreProxy.xml 檔案搭配 CurrentAppSimulator。
屬性
| 名稱 | Description |
|---|---|
| AppId |
取得仿真的應用程式標識碼。 由於 CurrentAppSimulator 僅適用於在應用程式開發期間進行測試,因此傳回的 CurrentAppSimulator.AppId 只會包含 0。 在 Windows 市集上列出您的應用程式之後,CurrentApp.AppId 會取得在應用程式上線期間產生的 GUID,並用來在 Windows 市集目錄中列出您的應用程式。 注意 應用程式更新或應用程式描述的變更,將不會導致變更 CurrentApp.AppId。 |
| LicenseInformation |
取得模擬所提供的目前應用程式的模擬授權元數據。 |
| LinkUri |
取得仿真的統一資源標識碼 (URI),代表目前應用程式的Microsoft市集清單頁面。 |
方法
| 名稱 | Description |
|---|---|
| GetAppPurchaseCampaignIdAsync() |
擷取目前應用程式的促銷活動標識碼。 |
| GetAppReceiptAsync() |
建立異步操作,讓用戶可用來模擬要求此應用程式的所有收據,以及任何應用程式內產品購買。 如需如何使用收據資訊的範例,請參閱 使用收據來驗證產品購買。 |
| GetProductReceiptAsync(String) |
建立異步操作,用戶可用來模擬要求指定產品標識碼的收據。 如需如何使用收據資訊的範例,請參閱 使用收據來驗證產品購買。 |
| GetUnfulfilledConsumablesAsync() |
傳回尚未在本機完成的已購買消費性應用程式內產品清單。 |
| LoadListingInformationAsync() |
以異步方式載入仿真的應用程式清單資訊。 傳回的 ListingInformation 物件包含使用者目前所在市場的特定清單資訊(例如名稱、價格、年齡分級)。 此外,也會提供透過應用程式內產品取得的產品清單資訊。 注意 為了模擬目的,這個方法會使用 WindowsStoreProxy.xml 檔案中的 專案作為傳回對象成員的數據源。 如需詳細資訊,請參閱 CurrentAppSimulator中的程式碼範例。 |
| LoadListingInformationByKeywordsAsync(IIterable<String>) |
以異步方式載入仿真的應用程式清單資訊,傳回 ProductListings 集合中符合所有提供關鍵詞的應用程式內產品。 |
| LoadListingInformationByProductIdsAsync(IIterable<String>) |
以異步方式載入仿真的應用程式清單資訊,傳回 ProductListings 集合中可用的應用程式內產品,這些集合符合任何指定的產品識別碼。 |
| ReloadSimulatorAsync(StorageFile) |
使用包含 WindowsStoreProxy.xml 檔案的 StorageFile 來重載模擬器。 如果您未呼叫這個方法來載入自己的檔案,模擬器會建立/載入(但不會覆寫)包含一組預設值的 WindowsStoreProxy.xml 檔案。 |
| ReportConsumableFulfillmentAsync(String, Guid) |
模擬通知 Microsoft Store,購買消費性附加元件(也稱為應用程式內產品或 IAP)已完成,且使用者有權存取內容。 |
| RequestAppPurchaseAsync(Boolean) |
Important 在提升級應用程式中不支援應用程式內購買功能。 建立異步操作,模擬使用者要求以購買目前應用程式的完整授權。 |
| RequestProductPurchaseAsync(String, Boolean) |
Important 在提升級應用程式中不支援應用程式內購買功能。 注意 [RequestProductPurchaseAsync(String, Boolean) 可能會在Windows 8.1之後變更或無法使用版本。 請改用 RequestProductPurchaseAsync(String)。 建立異步操作,以顯示用來模擬從Microsoft市集購買附加元件(也稱為應用程式內產品或 IAP)的 UI。 |
| RequestProductPurchaseAsync(String, String, ProductPurchaseDisplayProperties) |
Important 在提升級應用程式中不支援應用程式內購買功能。 建立異步操作,以顯示用來模擬從Microsoft市集購買附加元件(也稱為應用程式內產品或 IAP)的 UI。 此多載包含參數,可用來在市集中單一產品專案所代表的大型應用程式內購買目錄中,顯示特定供應專案的詳細數據。 |
| RequestProductPurchaseAsync(String) |
Important 在提升級應用程式中不支援應用程式內購買功能。 建立異步操作,以顯示用來模擬從Microsoft市集購買附加元件(也稱為應用程式內產品或 IAP)的 UI。 |