public static class DesktopPlatform Provides read-only platform presentation discovery.
Properties
IsHighContrast
public static bool IsHighContrast { get; } Gets whether the operating system currently uses a high-contrast theme.
Remarks
A synchronous probe of the current setting, which decides a window's initial theme when DesktopWindowOptions.HighContrast is not set. To follow changes while the application runs, observe IDesktopSettings from Runic.Platform (ReadAsync and WatchAsync, whose DesktopAppearance.HighContrast reports the same setting, and DesktopAppearance.Contrast tells more contrast and forced colours apart). A window without the option follows a change while it is open.
Methods
GetAvailability
public static DesktopAvailabilityResult GetAvailability(DesktopHostOptions? options = null) Inspects the installed browsers and the embedded presentation of a host configuration without starting a host or opening a window.
Parameters
optionsThe options the host will start with;
nullfornew DesktopHostOptions(). TheirDesktopHostOptions.BrowserFolder,DesktopHostOptions.LinuxandDesktopHostOptions.WindowHostFactoryare read, so a configuration such asnew DesktopHostOptions().WithGtk4()or a WPFRunicWebViewfactory reports its own window host.
Returns
One entry per discoverable browser, then DesktopAvailabilityResult.Embedded, and on Linux the toolkit libraries in DesktopAvailabilityResult.LinuxBackends.
Exceptions
ArgumentExceptionDesktopHostOptions.Linuxisnull, or a Linux window host factory's backend differs fromLinuxDesktopOptions.EmbeddedBackend, whichDesktopHost.StartAsyncrejects too.
Remarks
DesktopHost.GetPresentationPreflight and DesktopHost.Validate evaluate a window request with this result for the host's own options, so a check before DesktopEventLoop chooses its loop gives the same answer as the host. Opening a window remains the final check: a window host may still fail, for example when the GTK 4 loop finds no display.
Without DesktopHostOptions.WindowHostFactory, the embedded entry describes the built-in WebView2, WKWebView or WebKitGTK host, and its DesktopPresentationAvailability.Capabilities leave out what is known only once the native toolkit has loaded; an open window's DesktopWindow.Capabilities is authoritative. With a factory, the entry has the factory's IDesktopWindowHostFactory.IsSupported and IDesktopWindowHostFactory.Capabilities, and when it is not supported, the Linux selection problems and IDesktopWindowHostFactory.GetAvailabilityDiagnostics, or custom-window-host-unavailable when neither reports one.
The call is synchronous: it checks files, asks the WebView2 loader and, on Linux, reads the loader cache once per process, which can take up to one second the first time. On macOS the embedded entry reports macos-main-thread-required when called off the main thread before a Desktop event loop runs. Diagnostic codes are an open set: treat an unknown code on an unavailable presentation as unavailable, and match entries by DesktopPresentationAvailability.Browser, since the list can grow.