Dela via


FocusSessionManager Class

Definition

Provides APIs that allow apps to manage the state of the Focus Session feature of Windows.

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

Windows requirements

Device family
Windows 11 Insider Preview (introduced in 10.0.23504.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v15.0)

Remarks

Get an instance of FocusSessionManager by calling GetDefault.

FocusSessionManager provides a programmatic way to read and manipulate the state of Focus, which is a feature intended to reduce distractions in Windows.

Properties

IsFocusActive

Gets a value indicating if a focus session is active on the device.

IsSupported

Gets a value indicating whether focus session APIs are supported on the device.

Methods

DeactivateFocus()

Ends all currently active focus sessions and turns Focus off.

Important

The FocusSessionManager.DeactivateFocus API is part of a Limited Access Feature (see LimitedAccessFeatures class). For more information or to request an unlock token, please use the LAF Access Token Request Form.

GetDefault()

Gets the default instance of the FocusSessionManager class.

GetSession(String)

Gets a FocusSession object representing the focus session with the specified Id.

TryStartFocusSession()

Attempts to start a focus session with no fixed end time.

Important

The FocusSessionManager.TryStartFocusSession API is part of a Limited Access Feature (see LimitedAccessFeatures class). For more information or to request an unlock token, please use the LAF Access Token Request Form.

TryStartFocusSession(DateTime)

Attempts to start a focus session that is active until explicitly cancelled.

Important

The FocusSessionManager.TryStartFocusSession API is part of a Limited Access Feature (see LimitedAccessFeatures class). For more information or to request an unlock token, please use the LAF Access Token Request Form.

Events

IsFocusActiveChanged

Raised when the focus session status of the device changes.

Applies to