共用方式為


PreviewBuildsManager 類別

定義

管理裝置的預覽組建狀態。

public ref class PreviewBuildsManager sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 393216)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class PreviewBuildsManager final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 393216)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class PreviewBuildsManager
Public NotInheritable Class PreviewBuildsManager
繼承
Object Platform::Object IInspectable PreviewBuildsManager
屬性

Windows 需求

規格需求 Description
裝置系列
Windows 10, version 1803 (已於 10.0.17134.0 引進)
API contract
Windows.Foundation.UniversalApiContract (已於 v6.0 引進)

範例

例如,在裝置的 [設定] 頁面中啟用Windows Insider Preview組建之後,OEM 裝置開發人員可能會使用此程式碼範例取得啟用碼,以在 Windows 測試人員註冊入口網站中註冊裝置。

public async Task<string> ActivateDevice() 
{ 
    PreviewBuildsManager manager = PreviewBuildsManager.GetDefault(); 
    if (manager != null) 
    { 
        // The user wants to activate their device to receive Windows Insider Preview Builds 
        manager.ArePreviewBuildsAllowed = true; 

        await manager.SyncAsync(); 

        PreviewBuildsState state = manager.GetCurrentState(); 
        string activationCode; 
        if (state.Properties.ContainsKey("ActivationCode")) 
        { 
            return state.Properties["ActivationCode"].ToString(); 
        } 
    } 
    return String.Empty; 
} 

屬性

名稱 Description
ArePreviewBuildsAllowed

布林值,描述裝置上是否允許預覽組建。

方法

名稱 Description
GetCurrentState()

PreviewBuildsState物件的目前狀態。

GetDefault()

從裝置取得預設 的 PreviewBuildsManager

IsSupported()

判斷裝置是否支援此 API。

SyncAsync()

同步 PreviewBuildsManager 與伺服器以取得目前的資訊。

適用於