LicenseInformation 類別

定義

提供目前應用程式授權中繼資料的存取權。

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

Windows 需求

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

備註

對於應用程式的應用程式試用版,只要試用版尚未過期, IsActive 就會傳回 true。 在試用期間, IsTrial 會傳回 true;當客戶升級至應用程式的完整版本時,會傳回 false。

您可以在測試期間透過CurrentAppSimulator物件的LicenseInformation屬性或透過 Microsoft Store 散發應用程式時的CurrentApp物件的LicenseInformation屬性來存取此物件。

注意

CurrentApp物件會從 Microsoft Store 取得其資料,這需要您有 Microsoft Store 開發人員帳戶,且應用程式已在 Microsoft Store 中發佈。 如果您沒有 Microsoft Store 開發人員帳戶,您可以使用 CurrentAppSimulator來測試此類別的功能。

屬性

ExpirationDate

取得相對於系統時鐘的授權到期日期和時間。

IsActive

取得值,這個值表示授權是否作用中。

IsTrial

取得值,這個值表示授權是否為試用版授權。

ProductLicenses

取得使用者目前有權取得應用程式內產品的授權關聯清單。

事件

LicenseChanged

當應用程式授權的狀態變更時,引發通知事件。

適用於

另請參閱