Search Results for

    Show / Hide Table of Contents

    Class EventAggregator

    Allows listening to events without introducing direct coupling between observer and observable. The observer can handle events withou introducing a dependency to the event source.

    Inheritance
    Object
    EventAggregator
    Implements
    IEventAggregator
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: BionicCode.Utilities.Net
    Assembly: BionicCode.Utilities.Net.Common.dll
    Syntax
    public class EventAggregator : IEventAggregator

    Constructors

    | Improve this Doc View Source

    EventAggregator()

    Default constructor.

    Declaration
    public EventAggregator()

    Methods

    | Improve this Doc View Source

    TryRegisterGlobalObserver(Delegate)

    Registers a handler for any registered event source with a compatible event delegate signature.

    Declaration
    public bool TryRegisterGlobalObserver(Delegate eventHandler)
    Parameters
    Type Name Description
    Delegate eventHandler

    A delegate that handles the specified event.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterGlobalObserver(Delegate, Boolean)

    Registers a handler for any registered event source with a compatible event delegate signature.

    Declaration
    public bool TryRegisterGlobalObserver(Delegate eventHandler, bool isMarshalEventToCurrentThreadEnabled)
    Parameters
    Type Name Description
    Delegate eventHandler

    A delegate that handles the specified event.

    Boolean isMarshalEventToCurrentThreadEnabled

    true if the current SynchronizationContext should be captured to execute the event handler.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterGlobalObserver(Delegate, SynchronizationContext)

    Registers a handler for any registered event source with a compatible event delegate signature.

    Declaration
    public bool TryRegisterGlobalObserver(Delegate eventHandler, SynchronizationContext synchronizationContext)
    Parameters
    Type Name Description
    Delegate eventHandler

    A delegate that handles the specified event.

    SynchronizationContext synchronizationContext

    The SynchronizationContext that the event delegate is to be executed on.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterGlobalObserver(String, Delegate)

    Register an event delegate to handle a specific event which could be published by any type.

    Declaration
    public bool TryRegisterGlobalObserver(string eventName, Delegate eventHandler)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Delegate eventHandler

    A delegate that handles the specified event.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterGlobalObserver(String, Delegate, Boolean)

    Register an event delegate to handle a specific event which could be published by any type.

    Declaration
    public bool TryRegisterGlobalObserver(string eventName, Delegate eventHandler, bool isMarshalEventToCurrentThreadEnabled)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Delegate eventHandler

    A delegate that handles the specified event.

    Boolean isMarshalEventToCurrentThreadEnabled

    true if the current SynchronizationContext should be captured to execute the event handler.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterGlobalObserver(String, Delegate, SynchronizationContext)

    Register an event delegate to handle a specific event which could be published by any type.

    Declaration
    public bool TryRegisterGlobalObserver(string eventName, Delegate eventHandler, SynchronizationContext synchronizationContext)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Delegate eventHandler

    A delegate that handles the specified event.

    SynchronizationContext synchronizationContext

    The SynchronizationContext that the event delegate is to be executed on.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterGlobalObserver<TEventArgs>(EventHandler<TEventArgs>)

    Registers a handler for any registered event source with a compatible event delegate signature.

    Declaration
    public bool TryRegisterGlobalObserver<TEventArgs>(EventHandler<TEventArgs> eventHandler)
    Parameters
    Type Name Description
    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRegisterGlobalObserver<TEventArgs>(EventHandler<TEventArgs>, Boolean)

    Registers a handler for any registered event source with a compatible event delegate signature.

    Declaration
    public bool TryRegisterGlobalObserver<TEventArgs>(EventHandler<TEventArgs> eventHandler, bool isMarshalEventToCurrentThreadEnabled)
    Parameters
    Type Name Description
    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    Boolean isMarshalEventToCurrentThreadEnabled

    true if the current SynchronizationContext should be captured to execute the event handler.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRegisterGlobalObserver<TEventArgs>(EventHandler<TEventArgs>, SynchronizationContext)

    Registers a handler for any registered event source with a compatible event delegate signature.

    Declaration
    public bool TryRegisterGlobalObserver<TEventArgs>(EventHandler<TEventArgs> eventHandler, SynchronizationContext synchronizationContext)
    Parameters
    Type Name Description
    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    SynchronizationContext synchronizationContext

    The SynchronizationContext that the event delegate is to be executed on.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRegisterGlobalObserver<TEventArgs>(String, EventHandler<TEventArgs>)

    Register an event delegate to handle a specific event which could be published by any type.

    Declaration
    public bool TryRegisterGlobalObserver<TEventArgs>(string eventName, EventHandler<TEventArgs> eventHandler)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRegisterGlobalObserver<TEventArgs>(String, EventHandler<TEventArgs>, Boolean)

    Register an event delegate to handle a specific event which could be published by any type.

    Declaration
    public bool TryRegisterGlobalObserver<TEventArgs>(string eventName, EventHandler<TEventArgs> eventHandler, bool isMarshalEventToCurrentThreadEnabled)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    Boolean isMarshalEventToCurrentThreadEnabled

    true if the current SynchronizationContext should be captured to execute the event handler.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRegisterGlobalObserver<TEventArgs>(String, EventHandler<TEventArgs>, SynchronizationContext)

    Register an event delegate to handle a specific event which could be published by any type.

    Declaration
    public bool TryRegisterGlobalObserver<TEventArgs>(string eventName, EventHandler<TEventArgs> eventHandler, SynchronizationContext synchronizationContext)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    SynchronizationContext synchronizationContext

    The SynchronizationContext that the event delegate is to be executed on.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRegisterObservable(Object, IEnumerable<String>)

    Register a type as event source.

    Declaration
    public bool TryRegisterObservable(object eventSource, IEnumerable<string> eventNames)
    Parameters
    Type Name Description
    Object eventSource

    The publisher instance.

    IEnumerable<String> eventNames

    A collection of event names that define the observed events of the eventSource

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterObserver(String, Type, Delegate)

    Registers an event delegate to handle a specific event published by a specific observable type.

    Declaration
    public bool TryRegisterObserver(string eventName, Type eventSourceType, Delegate eventHandler)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Type eventSourceType

    The type of the observable.

    Delegate eventHandler

    A delegate that handles the specified event.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterObserver(String, Type, Delegate, Boolean)

    Registers an event delegate to handle a specific event published by a specific observable type.

    Declaration
    public bool TryRegisterObserver(string eventName, Type eventSourceType, Delegate eventHandler, bool isMarshalEventToCurrentThreadEnabled)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Type eventSourceType

    The type of the observable.

    Delegate eventHandler

    A delegate that handles the specified event.

    Boolean isMarshalEventToCurrentThreadEnabled

    true if the current SynchronizationContext should be captured to execute the event handler.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterObserver(String, Type, Delegate, SynchronizationContext)

    Registers an event delegate to handle a specific event published by a specific observable type.

    Declaration
    public bool TryRegisterObserver(string eventName, Type eventSourceType, Delegate eventHandler, SynchronizationContext synchronizationContext)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Type eventSourceType

    The type of the observable.

    Delegate eventHandler

    A delegate that handles the specified event.

    SynchronizationContext synchronizationContext

    The SynchronizationContext that the event delegate is to be executed on.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    | Improve this Doc View Source

    TryRegisterObserver<TEventArgs>(String, Type, EventHandler<TEventArgs>)

    Registers an event delegate to handle a specific event published by a specific observable type.

    Declaration
    public bool TryRegisterObserver<TEventArgs>(string eventName, Type eventSourceType, EventHandler<TEventArgs> eventHandler)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Type eventSourceType

    The type of the observable.

    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRegisterObserver<TEventArgs>(String, Type, EventHandler<TEventArgs>, Boolean)

    Registers an event delegate to handle a specific event published by a specific observable type.

    Declaration
    public bool TryRegisterObserver<TEventArgs>(string eventName, Type eventSourceType, EventHandler<TEventArgs> eventHandler, bool isMarshalEventToCurrentThreadEnabled)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Type eventSourceType

    The type of the observable.

    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    Boolean isMarshalEventToCurrentThreadEnabled

    true if the current SynchronizationContext should be captured to execute the event handler.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRegisterObserver<TEventArgs>(String, Type, EventHandler<TEventArgs>, SynchronizationContext)

    Registers an event delegate to handle a specific event published by a specific observable type.

    Declaration
    public bool TryRegisterObserver<TEventArgs>(string eventName, Type eventSourceType, EventHandler<TEventArgs> eventHandler, SynchronizationContext synchronizationContext)
    Parameters
    Type Name Description
    String eventName

    The name of the observed event.

    Type eventSourceType

    The type of the observable.

    EventHandler<TEventArgs> eventHandler

    A delegate that handles the specified event.

    SynchronizationContext synchronizationContext

    The SynchronizationContext that the event delegate is to be executed on.

    Returns
    Type Description
    Boolean

    true when registration was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRemoveAllObservers(String)

    Removes all event handlers for a specified event no matter event publisher type.

    Declaration
    public bool TryRemoveAllObservers(string eventName)
    Parameters
    Type Name Description
    String eventName

    The event name of the event that the delegate is handling.

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    | Improve this Doc View Source

    TryRemoveAllObservers(String, Type)

    Removes all event handlers for a specific event publisher type and specific event.

    Declaration
    public bool TryRemoveAllObservers(string eventName, Type eventSourceType)
    Parameters
    Type Name Description
    String eventName

    The event name of the event that the delegate is handling.

    Type eventSourceType

    The type of the event publisher.

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    | Improve this Doc View Source

    TryRemoveAllObservers(Type)

    Removes all event handlers for a specified event publisher type.

    Declaration
    public bool TryRemoveAllObservers(Type eventSourceType)
    Parameters
    Type Name Description
    Type eventSourceType

    The type of the event publisher.

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    | Improve this Doc View Source

    TryRemoveGlobalObserver(Delegate)

    Removes the event handler for all registered events with a compatible event delegate signature.

    Declaration
    public bool TryRemoveGlobalObserver(Delegate eventHandler)
    Parameters
    Type Name Description
    Delegate eventHandler

    The event handler to remove.

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    | Improve this Doc View Source

    TryRemoveGlobalObserver(String, Delegate)

    Removes the event handler for a specified event no matter the event publisher type.

    Declaration
    public bool TryRemoveGlobalObserver(string eventName, Delegate eventHandler)
    Parameters
    Type Name Description
    String eventName

    The event name of the event that the delegate is handling.

    Delegate eventHandler

    The event handler to remove

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    | Improve this Doc View Source

    TryRemoveGlobalObserver<TEventArgs>(EventHandler<TEventArgs>)

    Removes the event handler for all registered events with a compatible event delegate signature.

    Declaration
    public bool TryRemoveGlobalObserver<TEventArgs>(EventHandler<TEventArgs> eventHandler)
    Parameters
    Type Name Description
    EventHandler<TEventArgs> eventHandler

    The event handler to remove.

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRemoveGlobalObserver<TEventArgs>(String, EventHandler<TEventArgs>)

    Removes the event handler for a specified event no matter the event publisher type.

    Declaration
    public bool TryRemoveGlobalObserver<TEventArgs>(string eventName, EventHandler<TEventArgs> eventHandler)
    Parameters
    Type Name Description
    String eventName

    The event name of the event that the delegate is handling.

    EventHandler<TEventArgs> eventHandler

    The event handler to remove

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    | Improve this Doc View Source

    TryRemoveObservable(Object, Boolean)

    Unregister the event publisher for all events.

    Declaration
    public bool TryRemoveObservable(object eventSource, bool removeObserversOfEvents = false)
    Parameters
    Type Name Description
    Object eventSource

    The event publisher instance.

    Boolean removeObserversOfEvents
    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    | Improve this Doc View Source

    TryRemoveObservable(Object, IEnumerable<String>, Boolean)

    Unregister the event publisher for a collection of specified events.

    Declaration
    public bool TryRemoveObservable(object eventSource, IEnumerable<string> eventNames, bool removeEventObservers = false)
    Parameters
    Type Name Description
    Object eventSource

    The event publisher instance.

    IEnumerable<String> eventNames

    The names of the events to unregister.

    Boolean removeEventObservers

    If true removes all event listeners of the specified events. The value is false by default.

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    | Improve this Doc View Source

    TryRemoveObserver(String, Type, Delegate)

    Removes the event handler for a specified event of a certain event publisher type.

    Declaration
    public bool TryRemoveObserver(string eventName, Type eventSourceType, Delegate eventHandler)
    Parameters
    Type Name Description
    String eventName

    The event name of the event that the delegate is handling.

    Type eventSourceType

    The type of the event publisher.

    Delegate eventHandler

    The event handler to remove.

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    | Improve this Doc View Source

    TryRemoveObserver<TEventArgs>(String, Type, EventHandler<TEventArgs>)

    Removes the event handler for a specified event of a certain event publisher type.

    Declaration
    public bool TryRemoveObserver<TEventArgs>(string eventName, Type eventSourceType, EventHandler<TEventArgs> eventHandler)
    Parameters
    Type Name Description
    String eventName

    The event name of the event that the delegate is handling.

    Type eventSourceType

    The type of the event publisher.

    EventHandler<TEventArgs> eventHandler

    The event handler to remove.

    Returns
    Type Description
    Boolean

    true when removal was successful, otherwise false.

    Type Parameters
    Name Description
    TEventArgs

    The type of the event args object.

    Implements

    IEventAggregator

    Extension Methods

    HelperExtensionsCommon.ToDictionary(Object)
    HelperExtensionsCommon.ToFlatDictionary(Object)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX