Class MixedRealityServiceRegistry
Static class that represents the Mixed Reality Toolkit service registry.
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit
Assembly: cs.temp.dll.dll
Syntax
public static class MixedRealityServiceRegistry
Remarks
The service registry is used to enable discovery of and access to active Mixed Reality Toolkit services at runtime without requiring direct code reference to a singleton style component.
Methods
AddService<T>(T, IMixedRealityServiceRegistrar)
Adds an IMixedRealityService instance to the registry.
Declaration
public static bool AddService<T>(T serviceInstance, IMixedRealityServiceRegistrar registrar)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
T | serviceInstance | Instance of the service to add. |
IMixedRealityServiceRegistrar | registrar | Instance of the registrar manages the service. |
Returns
Type | Description |
---|---|
Boolean | True if the service was successfully added, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service being added. |
ClearAllServices()
Clears the registry cache of all services
Declaration
public static void ClearAllServices()
GetAllServices()
Returns readonly list of all services registered
Declaration
public static IReadOnlyCollection<IMixedRealityService> GetAllServices()
Returns
Type | Description |
---|---|
IReadOnlyCollection<IMixedRealityService> |
Remarks
The list is sorted in ascending priority order.
GetAllServices(IMixedRealityServiceRegistrar)
Returns readonly list of all services registered for given registrar
Declaration
public static IReadOnlyCollection<IMixedRealityService> GetAllServices(IMixedRealityServiceRegistrar registrar)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityServiceRegistrar | registrar | Registrar object to filter services by |
Returns
Type | Description |
---|---|
IReadOnlyCollection<IMixedRealityService> | Readonly list of all services registered for given registrar, all services if parameter null. If given a registrar that the registry is not aware of, returns null. |
Remarks
The list is sorted in ascending priority order.
RemoveService<T>(T)
Removes an IMixedRealityService instance from the registry.
Declaration
public static bool RemoveService<T>(T serviceInstance)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
T | serviceInstance | Instance of the service to remove. |
Returns
Type | Description |
---|---|
Boolean | True if the service was successfully removed, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service being removed. |
RemoveService<T>(T, IMixedRealityServiceRegistrar)
Removes an IMixedRealityService instance from the registry.
Declaration
public static bool RemoveService<T>(T serviceInstance, IMixedRealityServiceRegistrar registrar)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
T | serviceInstance | Instance of the service to remove. |
IMixedRealityServiceRegistrar | registrar | Instance of the registrar manages the service. |
Returns
Type | Description |
---|---|
Boolean | True if the service was successfully removed, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service being removed. |
RemoveService<T>(String)
Removes an IMixedRealityService instance from the registry.
Declaration
public static bool RemoveService<T>(string name)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
String | name | The friendly name of the service to remove. |
Returns
Type | Description |
---|---|
Boolean | True if the service was successfully removed, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service being removed. |
TryGetService(Type, out IMixedRealityService, out IMixedRealityServiceRegistrar, String)
Gets the first instance of the requested service from the registry that matches the given query.
Declaration
public static bool TryGetService(Type interfaceType, out IMixedRealityService serviceInstance, out IMixedRealityServiceRegistrar registrar, string name = null)
Parameters
Type | Name | Description |
---|---|---|
Type | interfaceType | The interface type of the service being requested. |
IMixedRealityService | serviceInstance | Output parameter to receive the requested service instance. |
IMixedRealityServiceRegistrar | registrar | Output parameter to receive the registrar that loaded the service instance. |
String | name | Optional name of the service. |
Returns
Type | Description |
---|---|
Boolean | True if the requested service is being returned, false otherwise. |
TryGetService<T>(out T, out IMixedRealityServiceRegistrar, String)
Gets the first instance of the requested service from the registry that matches the given query.
Declaration
public static bool TryGetService<T>(out T serviceInstance, out IMixedRealityServiceRegistrar registrar, string name = null)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
T | serviceInstance | Output parameter to receive the requested service instance. |
IMixedRealityServiceRegistrar | registrar | Output parameter to receive the registrar that loaded the service instance. |
String | name | Optional name of the service. |
Returns
Type | Description |
---|---|
Boolean | True if the requested service is being returned, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service being requested. |
TryGetService<T>(out T, String)
Gets the first instance of the requested service from the registry that matches the given query.
Declaration
public static bool TryGetService<T>(out T serviceInstance, string name = null)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
T | serviceInstance | Output parameter to receive the requested service instance. |
String | name | Optional name of the service. |
Returns
Type | Description |
---|---|
Boolean | True if the requested service is being returned, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service being requested. |