public interface IDesktopMonitors The desktop's monitors: listing them and following changes.
Remarks
Methods are safe to call from any thread; results and watch items arrive on the thread pool. A service that cannot list monitors, such as one of a host without a native window toolkit, reports Unavailable.
Methods
ListAsync
ValueTask<PlatformResult<ImmutableArray<DesktopMonitor>>> ListAsync(CancellationToken cancellationToken = default) Lists the connected monitors, the primary one first where there is one.
Parameters
cancellationTokenCancels waiting for the result.
WatchAsync
IAsyncEnumerable<PlatformResult<ImmutableArray<DesktopMonitor>>> WatchAsync(CancellationToken cancellationToken = default) Reports the current monitors, then the whole list again after each change.
Parameters
cancellationTokenEnds the watch.
Remarks
A change is a monitor connected or disconnected, or a change of its bounds, work area, scale or primary flag; a change that leaves the list equal is not reported. When reading the monitors fails, the watch reports that result and ends. A service without monitors reports Unavailable once and then waits.