RunicWindowServiceCollectionExtensions class

Namespace Runic.Application.Views in Runic.Application.Views 0.23.0

public static class RunicWindowServiceCollectionExtensions

Registers IRunicWindowService for dependency injection.

Methods

AddRunicWindowService

public static IServiceCollection AddRunicWindowService(this IServiceCollection services)

Registers IRunicWindowService and IRunicApplicationLocale as singletons, and IRunicWindowContext, IRunicWindowLocale, IRunicConnections, IRunicWindowPresentation, IRunicWindowParameter and IRunicWindowResult per scope. Existing registrations are kept.

Remarks

The window service follows the host, such as RunicDesktopHost or RunicCsWebUiHost, that most recently opened a Window with these services. A host binds it before it resolves that Window's ViewModel, so the service is ready in every ViewModel constructor and command. A service that uses it before the application opens its first Window gets an InvalidOperationException. The window context of each Window's scope is bound to that Window before its ViewModel is resolved.