Although Sitefinity CMS provides many events raised by the built-in modules, you can also create your custom events providing hooks to your code. In order to implement a custom event, you need to follow 3 steps.
All events provide an interface specifying the contract for the event. The interface has all properties that will be passed to the event handler as data. You should implement a custom interface for your event and include any properties you want. All interfaces should implement the IEvent interface.
When you raise the event, you will need to create an instance which will be passed to the handler. Since you cannot create interface instances, you will need a class which implements the interface.
Whenever you want to invoke the event handlers which have subscribed to your event, you should raise it. This can be done using a helper method of the EventHub class.
After you've done this, everyone will be able to subscribe to your event using the ICustomEvent interface. For more information on subscribing, read For developers: Work with events.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2020 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity