How to: Use Notifications with the Scheduler Event
- 3 min to read
This example demonstrates how to use the Notifications Module together with the Event class from the business class library and the Scheduler Module. The example is also applicable to a custom Event descendant.
- If you prefer to watch a video rather than walk through these step-by-step instructions, visit the corresponding tutorial on the DevExpress YouTube Channel: DevExpress XAF: Notifications. You can also see the functionality demonstrated here in the EF Demo (Code First) installed with XAF. By default, the EF Demo (Code First) application is installed in %PUBLIC%\Documents\DevExpress Demos 19.1\Components\eXpressApp Framework\EFDemoCodeFirst.
- Mobile applications do not support the Notifications and Scheduler Module, so the approach described in this topic cannot be implemented in the Mobile platform. Refer to the How to send push notifications to the XAF Mobile application using Azure Notifications Hub KB article to learn how to use push notifications in your Mobile application.
To enable the Notifications feature, add three modules to the corresponding projects of your solution, as shown below.
Add the NotificationsModule to your Module project.
Add the NotificationsModuleWeb to your Module.Web project.
Add the NotificationsModuleWin to your Module.Win project.
The Event business class has the Reminder property, which is hidden by default (this is done to preserve the Event Detail View layouts in existing applications). Run the Model Editor and adjust the Event_DetailView layout to make this property visible (see View Items Layout Customization). If you use a custom Event descendant, you should make the Reminder property visible in the descendant's Detail View too.
With Notifications enabled, end-users will have the capability to set reminders for each Event and XAF will show a popup window before an event starts. The amount of time between the reminder and the event's Start Date/Time can be selected in the Reminder property of the Event class.
If the Reminder property is set to "0 minutes", the window will pop up at the event's start time.
Run the WinForms or ASP.NET application and create a new Event in the past (the Start Date/Time should be earlier than the current time). Select "5 minutes" in the Reminder drop-down. Save the event and you will see the Reminder window in less than 10 seconds.