ProductLicense 類別

定義

提供與附加元件相關聯的授權相關資訊, (也稱為應用程式內產品或 IAP) 。

public ref class ProductLicense 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 ProductLicense 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 sealed class ProductLicense
Public NotInheritable Class ProductLicense
繼承
Object Platform::Object IInspectable ProductLicense
屬性

Windows 需求

裝置系列
Windows 10 (已於 10.0.10240.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v1.0 引進)

範例

下列程式碼範例示範如何使用這個物件來取得附加元件供應專案的到期日。

// get the license info for this app from the simulator
LicenseInformation licenseInformation = CurrentAppSimulator.LicenseInformation;

// get the license info for one of the app's in-app offers
ProductLicense inAppOfferLicense =
    licenseInformation.ProductLicenses["MyFavoriteInAppOffer"];

// get the expiration date of this in-app offer
DateTimeOffset expirationDate = inAppOfferLicense.ExpirationDate;

備註

LicenseInformation物件的ProductLicenses屬性包含這個物件的一或多個實例。

屬性

ExpirationDate

取得附加元件 (也稱為應用程式內產品或 IAP) 授權的目前到期日期和時間。

IsActive

指出附加元件 (目前是否也稱為應用程式內產品或 IAP) 授權。

IsConsumable

指出附加元件 (也稱為應用程式內產品或 IAP) 是否可取用。 可購買、使用及再次購買消費性附加元件。

ProductId

取得附加元件的識別碼 (也稱為應用程式內產品或 IAP) 。 應用程式會使用此識別碼來取得客戶透過應用程式內購買時所啟用之產品或功能的相關資訊。

適用於

另請參閱