Class BaseServiceManager
Base class providing service registration and management functionality. This class can be used to implement a custom service management component for one or more services, similar to the MixedRealityToolkit object.
Inheritance
Implements
Namespace: Microsoft.MixedReality.Toolkit.Experimental
Assembly: cs.temp.dll.dll
Syntax
public class BaseServiceManager : MonoBehaviour, IMixedRealityServiceRegistrar
Fields
registeredServices
The collection of registered services.
Declaration
protected Dictionary<Type, IMixedRealityService> registeredServices
Field Value
Type | Description |
---|---|
Dictionary<Type, IMixedRealityService> |
Methods
GetService<T>(String, Boolean)
Gets the instance of the registered service.
Declaration
public T GetService<T>(string name = null, bool showLogs = true)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the service. |
Boolean | showLogs | Indicates whether or not diagnostic logging should be performed in case of an error |
Returns
Type | Description |
---|---|
T | The registered service instance as the requested type. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service (ex: IMixedRealityBoundarySystem). |
GetServices<T>(String)
Gets the collection of the registered service instances matching the requested type.
Declaration
public IReadOnlyList<T> GetServices<T>(string name = null)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
String | name | Friendly name of the service. |
Returns
Type | Description |
---|---|
IReadOnlyList<T> | Read-only collection of the service instances, as the requested type. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service (ex: IMixedRealityBoundarySystem). |
Initialize<T>(Type, SupportedPlatforms, Object[])
Initialize a service.
Declaration
protected virtual void Initialize<T>(Type concreteType, SupportedPlatforms supportedPlatforms = null, params object[] args)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
Type | concreteType | The concrete type of the service to initialize. |
SupportedPlatforms | supportedPlatforms | The platform(s) on which the service is supported. |
Object[] | args | Arguments to provide to the service class constructor. |
Type Parameters
Name | Description |
---|---|
T | The interface type for the service to be initialized. |
IsServiceRegistered<T>(String)
Checks to see if a service of the specified type has been registered.
Declaration
public bool IsServiceRegistered<T>(string name = null)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the service. |
Returns
Type | Description |
---|---|
Boolean | True if the service is registered, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service (ex: IMixedRealityBoundarySystem). |
OnDestroy()
Declaration
protected virtual void OnDestroy()
OnDisable()
Declaration
protected virtual void OnDisable()
OnEnable()
Declaration
protected virtual void OnEnable()
RegisterService<T>(T)
Registers a service of the specified type.
Declaration
public bool RegisterService<T>(T serviceInstance)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
T | serviceInstance | An instance of the service to be registered. |
Returns
Type | Description |
---|---|
Boolean |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service to be registered (ex: IMixedRealityBoundarySystem). |
RegisterService<T>(Type, SupportedPlatforms, Object[])
Registers a service of the specified type.
Declaration
public bool RegisterService<T>(Type concreteType, SupportedPlatforms supportedPlatforms = null, params object[] args)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
Type | concreteType | The concrete type to instantiate. |
SupportedPlatforms | supportedPlatforms | The platform(s) on which the service is supported. |
Object[] | args | Optional arguments used when instantiating the concrete type. |
Returns
Type | Description |
---|---|
Boolean | True if the service was successfully registered, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service to be registered (ex: IMixedRealityBoundarySystem). |
Uninitialize<T>()
Uninitialize a service.
Declaration
protected virtual void Uninitialize<T>()
where T : IMixedRealityService
Type Parameters
Name | Description |
---|---|
T | The interface type for the service to uninitialize. |
UnregisterService<T>(T)
Unregisters a service.
Declaration
public bool UnregisterService<T>(T serviceInstance)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
T | serviceInstance |
Returns
Type | Description |
---|---|
Boolean | True if the service was successfully unregistered, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service to be unregistered (ex: IMixedRealityBoundarySystem). |
UnregisterService<T>(String)
Unregisters a service of the specified type.
Declaration
public bool UnregisterService<T>(string name = null)
where T : IMixedRealityService
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the service to unregister. |
Returns
Type | Description |
---|---|
Boolean | True if the service was successfully unregistered, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | The interface type of the service to be unregistered (ex: IMixedRealityBoundarySystem). |
Remarks
If the name argument is not specified, the first instance will be unregistered
Update()
Declaration
protected virtual void Update()