/*********************************************************************/ /* */ /* AgentService Framework */ /* www.agentservice.it */ /* */ /* Copyright (C) 2007 l.i.d.o. - DIST, University of Genoa, Italy */ /* GNU Lesser General Public License */ /* */ /* This library is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation, */ /* version 2.1 of the License. */ /* */ /* This library is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ /* */ /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the */ /* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */ /* Boston, MA 02111-1307, USA. */ /* */ /*********************************************************************/ using AgentService.Platform; //using AgentService.Platform.Modules; using AgentService.Platform.Commands; namespace AgentService.Platform { /// /// Class PlatformCustomEventargs. Defines the event argument for all the handlers /// that will be attached to the platform context. /// public class PlatformEventArgs { /// /// type of the event /// private PlatformEvent type; /// /// Gets the type of the event /// public PlatformEvent Type { get { return this.type; } } /// /// name of the event, in case of /// custom events, the name distinguish /// the type of the event /// private string name; /// /// Gets the name of the event /// public string Name { get { return this.name; } } /// /// additional event data /// protected object data; /// /// Gets the additional data /// attached to the event /// public object Data { get { return this.data; } } /// /// Constructs a PlatformEventArgsobject by specifying the /// given PlatformEvent. /// /// declares the type of the event /// name of the event public PlatformEventArgs(PlatformEvent type, string name) { this.type = type; switch (this.type) { case PlatformEvent.AgentCreated: this.name = "AgentCreated"; break; case PlatformEvent.AgentPersisted: this.name = "AgentPersisted"; break; case PlatformEvent.AgentStopped: this.name = "AgentStopped"; break; case PlatformEvent.AgentResumed: this.name = "AgentResumed"; break; case PlatformEvent.AgentWokenUp: this.name = "AgentWokenUp"; break; case PlatformEvent.AssemblyRemoved: this.name = "AssemblyRemoved"; break; case PlatformEvent.AssemblyUploaded: this.name = "AssemblyUploaded"; break; case PlatformEvent.ConversationRequested: this.name = "ConversationRequested"; break; case PlatformEvent.ConversationAccepted: this.name = "ConversationAccepted"; break; case PlatformEvent.ConversationRefused: this.name = "ConversationRefused"; break; case PlatformEvent.ConversationClosed: this.name = "ConversationClosed"; break; case PlatformEvent.MessageSent: this.name = "MessageSent"; break; case PlatformEvent.MessageReceived: this.name = "MessageReceived"; break; case PlatformEvent.MessageBatch: this.name = "MessageBatch"; break; default: { // custom events this.name = name; } break; } } /// /// Constructs a PlatformEventArgsobject by specifying the /// given PlatformEvent and the additional data attached to /// the event. /// /// declares the type of the event /// name of the event /// additional data public PlatformEventArgs(PlatformEvent type, string name, object data) : this(type, name) { this.data = data; } } /// /// Enum PlatformEvent. enumeration of possible /// platform events /// public enum PlatformEvent { /// /// Identifies the OnAgentCreated event /// AgentCreated, /// /// Identifies the OnAgentResumed event /// AgentResumed, /// /// Identifies the OnAgentStopped event /// AgentStopped, /// /// Identifies the OnAgentWokenUp event /// AgentWokenUp, /// /// Identifies the OnAgentPersisted event /// AgentPersisted, /// /// Identifies the OnMessageBatch event /// MessageBatch, /// /// Identifies the OnMessageSent event /// MessageSent, /// /// Identifies the OnMessageReceived event /// MessageReceived, /// /// Identifies the OnConversationRequested event /// ConversationRequested, /// /// Identifies the OnConversationAccepted event /// ConversationAccepted, /// /// Identifies the OnConversationRefused event /// ConversationRefused, /// /// Identifies the OnConversationClosed event /// ConversationClosed, /// /// Identifies the OnAssemblyRemoved event /// AssemblyRemoved, /// /// Identifies the OnAssemblyUploaed event /// AssemblyUploaded, /// /// Identifies custom events /// Custom } /// /// Delegate PlatformEventHandler. Defines the common event handler for all the /// events defined in the IPlatformContext interface. /// public delegate void PlatformEventHandler(object sender, PlatformEventArgs args); }