public interface IPlatformEverything the operating system does for us, behind one object.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
One implementation per platform, chosen by the app head at boot and put in the ServiceRegistry. Nothing above this assembly has a #if ANDROID: code that needs to know what it is running on asks Capabilities, which is a runtime question with a runtime answer, and gets a fallback path rather than a compile error on five of the six targets.
Threading. The platform is owned by the thread that created it. Every member here except Post on the queue behind PumpEvents must be called from that thread, because the underlying APIs demand it — Win32 messages are delivered to the thread that created the window, and AppKit refuses to touch a window from anywhere but the main thread. That is a restriction of the operating systems, not a simplification of ours, and hiding it behind a lock would make it a deadlock instead of an exception.
Fields and properties (12)
string NameA name for logs and crash reports: "Desktop (macOS)", "Headless".
PlatformCapabilities CapabilitiesWhat this platform can do.
IReadOnlyList<IWindow> WindowsEvery window that exists now, in creation order.
IDisplayInfo DisplaysThe displays.
IFileSystemHost FileSystemWhere this platform keeps files.
IClipboard ClipboardThe system clipboard.
INativeDialogs DialogsNative pickers and message boxes.
ILifecycle LifecycleThe process's lifecycle.
IInputSource InputRaw input devices and their state.
ITextInput TextInputText entry and the IME.
IPowerInfo PowerBattery and thermal state.
IProcessorTopology ProcessorsHow many processors there are, and whether threads may be pinned to them.
Methods (4)
IWindow CreateWindow(in WindowOptions options)Creates a window.
bool TryGetWindow(uint id, out IWindow? window)Finds a window by the id its events carry.
ReadOnlySpan<PlatformEvent> PumpEvents()Collects everything the OS has to say and returns it, in the order it happened.
bool TryOpenUrl(string url)Opens a URL in whatever the user has set as their handler for it.
Used by (17)
- UiHostHelloUi
- AppBuilderVixen.App.Hosting
- AppServicesVixen.App.Hosting
- DesktopPlatformVixen.Platform.Desktop
- HeadlessPlatformVixen.Platform.Headless
- IPlatformFactoryVixen.App.Hosting
- PlatformExtensionsVixen.Platform
- PlatformWindowHostVixen.Platform.Ui
- VixenApplicationVixen.App.Hosting
- AppBackendTestsVixen.App.Tests
- EditorHostVixen.Editor.Host
- EditorServicesVixen.Editor.App
- FactoryVixen.App
- PlatformHostVixen.App
- StoppingGameVixen.App.Tests
- VixenApplicationTestsVixen.App.Tests
- WindowPlacementVixen.Editor.Host