public MessageEventArgs(Agent Destination, Message newMessage) { destination = Destination; message = newMessage; }
public BroadcastMessageEventArgs(Message newMessage) { message = newMessage; }
public void Broadcast(Message aMessage) { BroadcastEvent(this, new BroadcastMessageEventArgs(aMessage)); }
public void SendPost(Agent destination, ref Message aMessage) { // Check if the post box exists if (postbox.ContainsKey(destination)) { // Post box exists place post into the box // postbox[destination].Enqueue(aMessage); MessageEvent(this, new MessageEventArgs(destination, aMessage)); } else { // Throw exception indicating that the post box is not valid throw new Exception("No post box exists for that destination"); } }
void messageQueue_MessageEvent(object sender, MessageEventArgs e) { if (e.Destination.Equals(this)) { post = e.MailMessage; HandlePost(); } }