SchedulerDataStorage.ReminderAlert Event
Occurs when a reminder alert is invoked.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.1.dll
NuGet Package: DevExpress.Win.Scheduler
Declaration
Event Data
The ReminderAlert event's data class is ReminderEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
AlertNotifications | Gets any reminders currently triggered. |
Remarks
The XtraScheduler control supports reminders for appointments. A reminder can be invoked a specific time period before an appointment’s start time. When the reminder alerts, the ReminderAlert event fires. Handle this event to perform specific actions when a reminder is activated. For instance, play a sound or post specific data to a database server, etc.
Note that multiple reminders can raise at the same time. To get these reminders use the event’s ReminderEventArgs.AlertNotifications parameter. It holds a collection of notifications represented by ReminderAlertNotification objects. Each notification refers to the associated reminder and has a ReminderBaseAlertNotification.Handled property. Setting the Handled property to true indicates that this particular reminder is handled and that no default processing is required. For instance, you can postpone a reminder via the ReminderBase.Snooze method and then set the Handled property to true. In this case, the reminder will not be affected after completion of your event handler processing. If the Handled property is false, the reminder will be automatically switched off via the ReminderBase.Dismiss method.
If the SchedulerOptionsBehaviorBase.ShowRemindersForm property is true, a notification form is displayed when a reminder is invoked. Before the form is displayed, the SchedulerControl.RemindersFormShowing event is raised, and this allows you to display a custom form instead of a standard one.
Example
The following example demonstrates how to manually handle reminders and perform a custom action when the SchedulerStorageBase.ReminderAlert event is fired.
// Handle this event to perform a custom action when a reminder alert is fired.
schedulerStorage1.ReminderAlert += SchedulerStorage1_ReminderAlert;
// Specify the interval at which the reminder is polled for alert.
schedulerStorage1.RemindersCheckInterval = checkInterval * 1000;
// Hide the reminder alert window.
schedulerControl1.OptionsBehavior.ShowRemindersForm = false;
private void SchedulerStorage1_ReminderAlert(object sender, ReminderEventArgs e) {
// Create a new appointment.
Appointment app = schedulerStorage1.CreateAppointment(AppointmentType.Normal);
app.Subject = "Created on alert from appointment w/Price = " + e.AlertNotifications[0].ActualAppointment.CustomFields["CustomPrice"];
app.Start = e.AlertNotifications[0].ActualAppointment.Start.AddHours(2);
app.Duration = TimeSpan.FromHours(4);
schedulerStorage1.Appointments.Add(app);
// Modify the appointment for which the alert is triggered.
e.AlertNotifications[0].ActualAppointment.LabelKey = 3;
// Prevent the event from being fired one more time.
e.AlertNotifications[0].ActualAppointment.Reminder.Dismiss();
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ReminderAlert event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.