Example of using the HandlerChain Pattern or Chain of Responsibility pattern in C#. More...
Public Member Functions | |
void | Run () |
Executes the example for the HandlerChain Pattern in C#. | |
Private Member Functions | |
void | _HandlerChain_ConstructWindowChain (HandlerChain handlerChain) |
Helper method to construct a list of windows. Messages will be passed to these windows via the HandlerChain object. | |
Example of using the HandlerChain Pattern or Chain of Responsibility pattern in C#.
The Handler Chain pattern is used to support a dynamic list of handlers that are passed the same arguments. It is kind of the inverse of the Visitor pattern, where the Visitor pattern is a handler that is passed to all objects in a list and the Handler Chain pattern is an object passed to handlers in a list.
In this exercise, multiple rectangular regions called MessageWindows embody the handlers and the HandlerChain object passes message objects to each MessageWindow until the message is handled.
Definition at line 29 of file HandlerChain_Exercise.cs.
|
inlineprivate |
Helper method to construct a list of windows. Messages will be passed to these windows via the HandlerChain object.
handlerChain | The HandlerChain object that receives the new windows. |
Definition at line 37 of file HandlerChain_Exercise.cs.
References MessageWindow.CreateWindow().
Referenced by HandlerChain_Exercise.Run().
|
inline |
Executes the example for the HandlerChain Pattern in C#.
Definition at line 53 of file HandlerChain_Exercise.cs.
References HandlerChain_Exercise._HandlerChain_ConstructWindowChain(), and HandlerChain.SendMessage().
Referenced by Program.Run().