DevicePostureProvider Class
The source of the posture of the device (https://w3c.github.io/device-posture/#dfn-calculate-the-device-posture-information), read by the documents of the browsing contexts that share a BrowsingContextOptions (DevicePostureOptions.Provider). The default implementation returns DevicePostureProvider.Posture, set by the application. Override DevicePostureProvider.GetPosture to read another source, and call DevicePostureProvider.OnPostureChanged when the posture changes, to update the documents.
public class DevicePostureProviderRemarks
A provider can be shared by several browsing contexts, and used from any thread.
Constructors
| Name | Description |
|---|---|
| DevicePostureProvider() |
DevicePostureProvider()
DevicePosture.cspublic DevicePostureProvider()No documentation is available.
Properties
| Name | Description |
|---|---|
| Posture | Gets or sets the posture returned by the default implementation of DevicePostureProvider.GetPosture (DevicePostureType.Continuous by default). Setting it updates the documents: the DevicePosture objects of the visible documents fire their change events, and the media queries are evaluated again. |
Posture
DevicePosture.csGets or sets the posture returned by the default implementation of DevicePostureProvider.GetPosture (DevicePostureType.Continuous by default). Setting it updates the documents: the DevicePosture objects of the visible documents fire their change events, and the media queries are evaluated again.
public DevicePostureType Posture { get; set; }Property value
Methods
| Name | Description |
|---|---|
| GetPosture() | Returns the posture of the device. The default implementation returns DevicePostureProvider.Posture. It is called on the thread of an event loop, and must not block it. |
| OnPostureChanged() | Raises DevicePostureProvider.PostureChanged, then runs the device posture change steps (https://w3c.github.io/device-posture/#dfn-device-posture-change-steps) for the documents, and evaluates their media queries again. It can be called from any thread. |
GetPosture()
DevicePosture.csReturns the posture of the device. The default implementation returns DevicePostureProvider.Posture. It is called on the thread of an event loop, and must not block it.
public virtual DevicePostureType GetPosture()Returns
OnPostureChanged()
DevicePosture.csRaises DevicePostureProvider.PostureChanged, then runs the device posture change steps (https://w3c.github.io/device-posture/#dfn-device-posture-change-steps) for the documents, and evaluates their media queries again. It can be called from any thread.
protected void OnPostureChanged()Events
| Name | Description |
|---|---|
| PostureChanged | Raised when the posture changes (DevicePostureProvider.OnPostureChanged). |
PostureChanged
Raised when the posture changes (DevicePostureProvider.OnPostureChanged).
public event EventHandler? PostureChanged