Table of Contents

Class WeakEventManager

Namespace
Alternet.UI
Assembly
Alternet.UI.dll

This base class provides common functionality for event managers, in support of the "weak event listener" pattern.

public abstract class WeakEventManager : DispatcherObject, IBaseObject, IDisposableObject, IDisposable
Inheritance
WeakEventManager
Implements
Derived

Constructors

WeakEventManager()

Create a new instance of WeakEventManager.

Properties

this[object]

The data associated with the given source. Subclasses chose what to store here; most commonly it is a ListenerList - a list of weak references to listeners.

ReadLock

Take a read-lock on the table, and return the IDisposable. Queries to the table should occur within a "using (ReadLock) { ... }" clause, except for queries that are already within a write lock.

WriteLock

Take a write-lock on the table, and return the IDisposable. All modifications to the table should occur within a "using (WriteLock) { ... }" clause.

Methods

DeliverEvent(object, EventArgs)

Deliver an event to each listener.

DeliverEventToList(object, EventArgs, ListenerList)

Deliver an event to the listeners on the given list

GetCurrentManager(Type)

Get the current manager for the given manager type.

NewListenerList()

Return a new list to hold listeners to the event.

ProtectedAddHandler(object, Delegate)

Add a handler to the given source for the event.

ProtectedAddListener(object, IWeakEventListener)

Add a listener to the given source for the event.

ProtectedRemoveHandler(object, Delegate)

Remove a handler to the given source for the event.

ProtectedRemoveListener(object, IWeakEventListener)

Remove a listener to the given source for the event.

Purge(object, object, bool)

Remove dead entries from the data for the given source. Returns true if some entries were actually removed.

Remove(object)

Discard the data associated with the given source

ScheduleCleanup()

Schedule a cleanup pass.

SetCurrentManager(Type, WeakEventManager)

Set the current manager for the given manager type.

StartListening(object)

Listen to the given source for the event.

StopListening(object)

Stop listening to the given source for the event.