Share via


SystemSetupInfo Class

Definition

Provides a property and an event that describe the current stage in the lifecycle of the Out-of-Box Experience (OOBE).

public ref class SystemSetupInfo abstract sealed
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 458752)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class SystemSetupInfo final
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 458752)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public static class SystemSetupInfo
Public Class SystemSetupInfo
Inheritance
Object Platform::Object IInspectable SystemSetupInfo
Attributes

Windows requirements

Device family
Windows 10, version 1809 (introduced in 10.0.17763.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v7.0)

Examples

A Universal Windows Platform (UWP) app needs to know whether OOBE is complete, since it has special behavior during OOBE (for example, a scoped feature set in the user interface (UI), or background tasks that only start after OOBE is complete). As an OEM, this could be your app that runs during OOBE.

private bool ShouldUseSimpleUserInterface()
{
    var oobeState = Windows.System.Profile.SystemSetupInfo.OutOfBoxExperienceState;

    // When this UWP is shown before OOBE is complete, use a simplified UI
    // with limited options, which matches the style of the rest of OOBE.
    return (oobeState != SystemOutOfBoxExperienceState.Completed);
}

As an OEM, you want to know that a device successfully boots to OOBE during factory-floor testing. You want every device to go through this testing as a final verification step in your manufacturing process, and therefore during your automation you want to be notified when OOBE is in progress and ready.

// Task that has its result set once OOBE is in progress.
private TaskCompletionSource<object> oobeInProgress;

// Called when OOBE state changes. Guaranteed to be called at least once, at
// the time of event registration.
private void OnOobeStateChanged(object sender, object e)
{
    var oobeState = Windows.System.Profile.SystemSetupInfo.OutOfBoxExperienceState;
    if (oobeState == SystemOutOfBoxExperienceState.InProgress)
    {
        oobeInProgress.TrySetResult(null);
    } 
}

private async void WaitForOobeStartedAsync()
{
    oobeInProgress = new TaskCompletionSource<object>();
    Windows.System.Profile.SystemSetupInfo.OutOfBoxExperienceStateChanged += OnOobeStateChanged;
    await oobeInProgress.Task; // NOTE: you could add a timeout here, and fail when hit.
    Windows.System.Profile.SystemSetupInfo.OutOfBoxExperienceStateChanged -= OnOobeStateChanged;
 }

Remarks

The Out-of-Box Experience (OOBE) is the flow that occurs the first time the user turns on a Windows 10 device. The OOBE obtains acceptance of the EULA, sets the system default locale, and helps set up the initial user account.

Properties

OutOfBoxExperienceState

Gets a value representing the current stage in the lifecycle of the Out-of-Box Experience (OOBE).

Events

OutOfBoxExperienceStateChanged

Raised when the current stage in the lifecycle of the Out-of-Box Experience (OOBE) changes.

Applies to