This interface is implemented by all events fired for Comments. Use it, if you want to subscribe to all events. Subscribe using the following code:
EventHub.Subscribe<ICommentEvent>(evt => CommentsEventHandler(evt));
When you handle a generic event like this, no information is passed to your event handler. You can use a more specific event.
Your event handler must look in the following way:
public
void
CommentsEventHandler(ICommentEvent eventInfo)
{
// your logic
}
ICommentCreateEvent
This interface is implemented by all events that fire when a comment is created. There are two built-in events - ICommentCreatingEvent and ICommentCreatedEvent. Use the interface, if you want to subscribe to both.
You can subscribe with the following code:
EventHub.Subscribe<ICommentCreateEvent>(evt => CommentsEventHandler(evt));
In the event handler, you can access the date when the comment is created, in the following way:
public
void
CommentsEventHandler(ICommentCreateEvent eventInfo)
{
var creationDate = eventInfo.CreationDate;
}
ICommentCreatingEvent
This interface is implemented by all events that fire before a comment is created. There is only one such event, but you must subscribe using the interface, rather than the class that implements it.
Use the following code to subscribe:
EventHub.Subscribe<ICommentCreatingEvent>(evt => CommentsEventHandler(evt));
In the event handler, you can access the following information:
- The date when the comment is created.
- The actual comment that is created.
Your event handler must look in the following way:
public
void
CommentsEventHandler(ICommentCreatingEvent eventInfo)
{
var creationDate = eventInfo.CreationDate;
var comment = eventInfo.DataItem;
}
ICommentCreatedEvent
This interface is implemented by all events that fire aftera comment has been created. There is only one built-in event, but you must subscribe using the interface, rather than the class that implements it.
Use the following code to subscribe:
EventHub.Subscribe<ICommentCreatedEvent>(evt => CommentsEventHandler(evt));
In the event handler you can access the following information:
- The date when the comment was created.
- The ID of the comment that was created.
Your event handler must look in the following way:
public
void
CommentsEventHandler(ICommentCreatedEvent eventInfo)
{
var creationDate = eventInfo.CreationDate;
var commentId = eventInfo.CommentId;
}
ICommentUpdateEvent
This interface is implemented by all events that fire when a comment is updated. There are two such events - ICommentUpdatingEvent and ICommentUpdatedEvent. Use the interface, if you want to subscribe for both.
Use the following code to subscribe:
EventHub.Subscribe<ICommentUpdateEvent>(evt => CommentsEventHandler(evt));
In the event handler, you can access the date when the comment is modified.
Your event handler must look in the following way:
public
void
CommentsEventHandler(ICommentUpdateEvent eventInfo)
{
var modificationDate = eventInfo.ModificationDate;
}
ICommentUpdatingEvent
This interface is implemented by all events which fire beforea comment is updated. There is only one such built-in event, but you must subscribe to it using the interface, rather than the class that implements it.
Use the following code to subscribe:
EventHub.Subscribe<ICommentUpdatingEvent>(evt => CommentsEventHandler(evt));
In the event handler, you can access the following information:
- The date when the comment is updated.
- The actual comment that is updated.
Your event handler must look in the following way:
public
void
CommentsEventHandler(ICommentUpdatingEvent eventInfo)
{
var modificationDate = eventInfo.ModificationDate;
var comment = eventInfo.DataItem;
}
ICommentUpdatedEvent
This interface is implemented by all events which fire after a comment is updated. There is only one such built-in event, but you must subscribe to it using the interface, rather than the class that implements it.
Use the following code to subscribe:
EventHub.Subscribe<ICommentUpdatedEvent>(evt => CommentsEventHandler(evt));
In the event handler you can access the following information:
- The date when the comment was updated
- The ID of the comment which was just updated.
Your event handler must look in the following way:
public
void
CommentsEventHandler(ICommentUpdatedEvent eventInfo)
{
var modificationDate = eventInfo.ModificationDate;
var commentId = eventInfo.CommentId;
}
ICommentDeleteEvent
This interface is implemented by all events that fire when a comment is deleted. There are two such events - ICommentDeletingEvent and ICommentDeletedEvent. Use the interface if you want to subscribe for both. Use the following code to subscribe.
EventHub.Subscribe<ICommentDeleteEvent>(evt => CommentsEventHandler(evt));
In the event handler, you can access the date when the comment is deleted.
public
void
CommentsEventHandler(ICommentDeleteEvent eventInfo)
{
var deletionDate = eventInfo.DeletionDate;
}
ICommentDeletingEvent
This interface is implemented by all events which fire before a comment is deleted. There is only one such built-in event, but you should subscribe to it using the interface rather than the class that implements it, as mentioned in the beginning. Use the following code to subscribe.
EventHub.Subscribe<ICommentDeletingEvent>(evt => CommentsEventHandler(evt));
In the event handler, you can access the following information:
- The date when the comment is deleted.
- The actual comment which is about to be deleted.
public
void
CommentsEventHandler(ICommentDeletingEvent eventInfo)
{
var deletionDate = eventInfo.DeletionDate;
var comment = eventInfo.DataItem;
}
ICommentDeletedEvent
This interface is implemented by all events which fire after a comment has been deleted. There is only one such built-in event, but you should subscribe to it using the interface rather than the class that implements it, as mentioned in the beginning. Use the following code to subscribe.
EventHub.Subscribe<ICommentDeletedEvent>(evt => CommentsEventHandler(evt));
In the event handler you can access the following information:
- The date when the comment was deleted.
- The ID of the comment which was deleted.
public
void
CommentsEventHandler(ICommentDeletedEvent eventInfo)
{
var deletionDate = eventInfo.DeletionDate;
var commentId = eventInfo.CommentId;
}