8using System.Collections.Generic;
129 if (foundIndex != -1)
145 StringBuilder output =
new StringBuilder();
156 output.AppendFormat(
" {0}{1}", window.
ToString(), Environment.NewLine);
158 return output.ToString();
Represents a list of handlers that all implement the IMessageHandler interface. This list can be dyna...
void AddHandler(IMessageHandler window)
Add an instance of the IMessageHandler interface to end of the list of handlers, protected by a multi...
void RemoveHandler(IMessageHandler window)
Remove an instance of the IMessageHandler interface from the list, protected by a multi-threading loc...
List< IMessageHandler > _messageHandlers
The list of message handlers.
override string ToString()
Convert this HandlerChain to a string, protected by a multi-threading lock.
object _messageHandlersLock
Object used to lock access to the message handlers list for multi-threaded support.
void SendMessage(Message message)
Send a message to each of the handlers in the list, protected by a multi-threading lock.
Represents a handler in a chain of handlers. All objects that participate in the HandlerChain class m...
string ToString()
Convert the handler to a string.
bool ProcessMessage(Message message)
Called with a message on each window.
int ID
ID of the window. This is used to uniquely identify a window in the collection.
The namespace containing all Design Pattern Examples implemented in C#.
Represents a message sent to the windows. A message contains a type and a position.