Vixen
02b45cc4
csharp
public interface IPlatform

Everything 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)

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