Interface IEventDispatcher
Dispatches events from within a scope.
Namespace: Umbraco.Cms.Core.Events
Assembly: Umbraco.Core.dll
Syntax
public interface IEventDispatcher
Remarks
The name of the event is auto-magically discovered by matching the sender type, args type, and eventHandler type. If the match is not unique, then the name parameter must be used to specify the name in an explicit way.
What happens when an event is dispatched depends on the scope settings. It can be anything from "trigger immediately" to "just ignore". Refer to the scope documentation for more details.
Methods
View SourceDispatch(EventHandler, Object, EventArgs, String)
Dispatches an event.
Declaration
void Dispatch(EventHandler eventHandler, object sender, EventArgs args, string name = null)
Parameters
Type | Name | Description |
---|---|---|
EventHandler | eventHandler | The event handler. |
System.Object | sender | The object that raised the event. |
EventArgs | args | The event data. |
System.String | name | The optional name of the event. |
Remarks
See general remarks on the interface.
Dispatch<TArgs>(EventHandler<TArgs>, Object, TArgs, String)
Dispatches an event.
Declaration
void Dispatch<TArgs>(EventHandler<TArgs> eventHandler, object sender, TArgs args, string name = null)
Parameters
Type | Name | Description |
---|---|---|
EventHandler<TArgs> | eventHandler | The event handler. |
System.Object | sender | The object that raised the event. |
TArgs | args | The event data. |
System.String | name | The optional name of the event. |
Type Parameters
Name | Description |
---|---|
TArgs |
Remarks
See general remarks on the interface.
Dispatch<TSender, TArgs>(TypedEventHandler<TSender, TArgs>, TSender, TArgs, String)
Dispatches an event.
Declaration
void Dispatch<TSender, TArgs>(TypedEventHandler<TSender, TArgs> eventHandler, TSender sender, TArgs args, string name = null)
Parameters
Type | Name | Description |
---|---|---|
TypedEventHandler<TSender, TArgs> | eventHandler | The event handler. |
TSender | sender | The object that raised the event. |
TArgs | args | The event data. |
System.String | name | The optional name of the event. |
Type Parameters
Name | Description |
---|---|
TSender | |
TArgs |
Remarks
See general remarks on the interface.
DispatchCancelable(EventHandler, Object, CancellableEventArgs, String)
Dispatches a cancelable event.
Declaration
bool DispatchCancelable(EventHandler eventHandler, object sender, CancellableEventArgs args, string name = null)
Parameters
Type | Name | Description |
---|---|---|
EventHandler | eventHandler | The event handler. |
System.Object | sender | The object that raised the event. |
CancellableEventArgs | args | The event data. |
System.String | name | The optional name of the event. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the cancelable event was cancelled. |
Remarks
See general remarks on the interface.
DispatchCancelable<TArgs>(EventHandler<TArgs>, Object, TArgs, String)
Dispatches a cancelable event.
Declaration
bool DispatchCancelable<TArgs>(EventHandler<TArgs> eventHandler, object sender, TArgs args, string name = null)
where TArgs : CancellableEventArgs
Parameters
Type | Name | Description |
---|---|---|
EventHandler<TArgs> | eventHandler | The event handler. |
System.Object | sender | The object that raised the event. |
TArgs | args | The event data. |
System.String | name | The optional name of the event. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the cancelable event was cancelled. |
Type Parameters
Name | Description |
---|---|
TArgs |
Remarks
See general remarks on the interface.
DispatchCancelable<TSender, TArgs>(TypedEventHandler<TSender, TArgs>, TSender, TArgs, String)
Dispatches a cancelable event.
Declaration
bool DispatchCancelable<TSender, TArgs>(TypedEventHandler<TSender, TArgs> eventHandler, TSender sender, TArgs args, string name = null)
where TArgs : CancellableEventArgs
Parameters
Type | Name | Description |
---|---|---|
TypedEventHandler<TSender, TArgs> | eventHandler | The event handler. |
TSender | sender | The object that raised the event. |
TArgs | args | The event data. |
System.String | name | The optional name of the event. |
Returns
Type | Description |
---|---|
System.Boolean | A value indicating whether the cancelable event was cancelled. |
Type Parameters
Name | Description |
---|---|
TSender | |
TArgs |
Remarks
See general remarks on the interface.
GetEvents(EventDefinitionFilter)
Gets the collected events.
Declaration
IEnumerable<IEventDefinition> GetEvents(EventDefinitionFilter filter)
Parameters
Type | Name | Description |
---|---|---|
EventDefinitionFilter | filter |
Returns
Type | Description |
---|---|
IEnumerable<IEventDefinition> | The collected events. |
ScopeExit(Boolean)
Notifies the dispatcher that the scope is exiting.
Declaration
void ScopeExit(bool completed)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | completed | A value indicating whether the scope completed. |