IDesktopEventLoopWindowHostFactory interface

Namespace Runic.Desktop · Runic.Desktop 0.7.0-preview.5

public interface IDesktopEventLoopWindowHostFactory : IDesktopWindowHostFactory

Inherits or implements IDesktopWindowHostFactory.

A window host factory whose windows need it to own the process main thread.

Remarks

DesktopEventLoop.Run hands the application to IDesktopEventLoopWindowHostFactory.RunEventLoop instead of its own loop when IDesktopWindowHostFactory.IsSupported is true.

Methods

PrepareEventLoop

IReadOnlyList<DesktopDiagnostic> PrepareEventLoop()

Checks, on the thread that will run the loop, whether IDesktopEventLoopWindowHostFactory.RunEventLoop can start.

Returns

The reasons the loop cannot run, or an empty list when it can.

Remarks

DesktopEventLoop.Run calls this right before IDesktopEventLoopWindowHostFactory.RunEventLoop. Return the reasons the loop cannot run, for example that no display is available; the caller then reports them and runs the plain loop instead, and the factory should report IDesktopWindowHostFactory.IsSupported as false from then on. The default reports none.

RunEventLoop

int RunEventLoop(Func<Task<int>> application)

Runs application while the native toolkit owns the calling main thread.

Parameters

application

The application work. Windows from this factory can open while it runs.

Returns

The value returned by application.