EventManager Class
Namespace: Stride.UI.EventsAssembly: Stride.UI.dll
Provides event-related utility methods that register routed events for class owners and add class handlers.
public static class EventManager| Name | Description | |
|---|---|---|
| Methods | ||
| GetRoutedEvent(Type, String) | Finds the routed event identified by its name and owner. | |
| GetRoutedEvents() | Returns identifiers for routed events that have been registered to the event system. | |
| GetRoutedEventsForOwner(Type) | Finds all routed event identifiers for events that are registered with the provided owner type. | |
| RegisterClassHandler<T>(Type, RoutedEvent<T>, EventHandler<T>, Boolean) | Registers a class handler for a particular routed event, with the option to handle events where event data is already marked handled. | |
| RegisterRoutedEvent<T>(String, RoutingStrategy, Type) | Registers a new routed event. | |
Methods
GetRoutedEvent(Type, String)
Finds the routed event identified by its name and owner.
public static RoutedEvent GetRoutedEvent(Type ownerType, string eventName)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | ownerType | The type to start the search with. Base classes are included in the search. | 
| System.String | eventName | The event name. | 
Returns
| Type | Description | 
|---|---|
| RoutedEvent | The matching routed event identifier if any match is found; otherwise, null. | 
GetRoutedEvents()
Returns identifiers for routed events that have been registered to the event system.
public static RoutedEvent[] GetRoutedEvents()Returns
| Type | Description | 
|---|---|
| RoutedEvent[] | An array of type RoutedEvent that contains the registered objects. | 
GetRoutedEventsForOwner(Type)
Finds all routed event identifiers for events that are registered with the provided owner type.
public static RoutedEvent[] GetRoutedEventsForOwner(Type ownerType)Parameters
| Type | Name | Description | 
|---|---|---|
| System.Type | ownerType | The type to start the search with. Base classes are included in the search. | 
Returns
| Type | Description | 
|---|---|
| RoutedEvent[] | An array of matching routed event identifiers if any match is found; otherwise, null. | 
RegisterClassHandler<T>(Type, RoutedEvent<T>, EventHandler<T>, Boolean)
Registers a class handler for a particular routed event, with the option to handle events where event data is already marked handled.
public static void RegisterClassHandler<T>(Type classType, RoutedEvent<T> routedEvent, EventHandler<T> handler, bool handledEventsToo = false)
    where T : RoutedEventArgsParameters
| Type | Name | Description | 
|---|---|---|
| System.Type | classType | The type of the class that is declaring class handling. | 
| RoutedEvent<T> | routedEvent | The routed event identifier of the event to handle. | 
| System.EventHandler<T> | handler | A reference to the class handler implementation. | 
| System.Boolean | handledEventsToo | true to invoke this class handler even if arguments of the routed event have been marked as handled; false to retain the default behavior of not invoking the handler on any marked-handled event. | 
Type Parameters
| Name | Description | 
|---|---|
| T | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
RegisterRoutedEvent<T>(String, RoutingStrategy, Type)
Registers a new routed event.
public static RoutedEvent<T> RegisterRoutedEvent<T>(string name, RoutingStrategy routingStrategy, Type ownerType)
    where T : RoutedEventArgsParameters
| Type | Name | Description | 
|---|---|---|
| System.String | name | The name of the routed event. The name must be unique within the owner type (base class included) and cannot be null or an empty string. | 
| RoutingStrategy | routingStrategy | The routing strategy of the event as a value of the enumeration. | 
| System.Type | ownerType | The owner class type of the routed event. This cannot be null. | 
Returns
| Type | Description | 
|---|---|
| RoutedEvent<T> | The identifier for the newly registered routed event. This identifier object can now be stored as a static field in a class and then used as a parameter for methods that attach handlers to the event. The routed event identifier is also used for other event system APIs. | 
Type Parameters
| Name | Description | 
|---|---|
| T | 
Exceptions
| Type | Condition | 
|---|---|
| System.ArgumentNullException | 
 | 
| System.InvalidOperationException | This exception is thrown if a routed event of name  |