Share via


Event Adapters

Event adapters handle events raised in the physical views and send them to the Engine and ultimately the workunit workflow. An initialization step allows event adapters to intercept the events. You must customize the other methods of the interface to pass the intercepted events to the engine appropriately.

The following code shows an example of the Event adapter interface:

public interface IPhysicalEventAdapter
{
event EventHandler EventBind;
void EventAdapterInitialization(string initializationString, string[] targets,object view);
string Name { get;}
Type[] Targets { get;}
Type EventType { get;}
string Description { get;}
}

The adapter is initialized when the view is created by the method EventAdapterInitialization, which than fires the event through the EventBind event. The interface includes the following objects:

  • EventBind: The event to fire associated with this adapter. The EventAdapter handles only one event at any given time.
  • EventAdapterInitialization: An initialization method called to bind the adapter instance to a physical view. The adapter receives an initialization string provided in the configuration and an array of targets paths pointing to the view. The targets are, typically, path to events raised by the view’s controls where in the view is provided as an object. During this method, the adapter hooks up the events required for its processing, sets up the necessary logic to handle them, and fires the logical event to the workflow via the EventBind event.
  • Name: A common name allowing adapter-identification at design time, which irrelevant at runtime.
  • Targets: A collection of Type objects that describe the expected types of the Target objects
  • EventType: This is derived from the EventHandler and is the type of the event to be fired.
  • Description: A string describing the usage of the adapter to be displayed by design tools. It’s irrelevant at runtime.