TimeIntervalEventArgs Class
Provides data for the SchedulerStorageBase.FetchAppointments event.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.2.Core.dll
Declaration
Remarks
The SchedulerStorageBase.FetchAppointments event can be called to retrieve appointments which satisfy the specified time interval from a datasource to the SchedulerStorageBase. The TimeIntervalEventArgs class introduces the TimeIntervalEventArgs.Interval property which specifies the time interval for which the appointments should be fetched.
An instance of the TimeIntervalEventArgs class with appropriate settings is automatically created and passed to the corresponding event’s handler.
Example
This example demonstrates how to work with a large amount of data in the Scheduler Storage. To speed up processing when there is a lot of data, the SchedulerStorageBase.FetchAppointments event should be used. Handle this event, so as to fetch only the data for the visible time interval.
To pad the time interval used to query appointments, a range of seven days is chosen. You can specify your own time range, as your need dictates.
public partial class Form1 : Form
{
TimeInterval lastFetchedInterval = new TimeInterval();
// ...
private void schedulerStorage1_FetchAppointments(object sender,
DevExpress.XtraScheduler.FetchAppointmentsEventArgs e)
{
DateTime start = e.Interval.Start;
DateTime end = e.Interval.End;
// Check if the requested interval is outside lastFetchedInterval
if (start <= lastFetchedInterval.Start || end >= lastFetchedInterval.End)
{
lastFetchedInterval = new TimeInterval(start - TimeSpan.FromDays(7),
end + TimeSpan.FromDays(7));
carSchedulingTableAdapter.FillBy(this.carsDBDataSet.CarScheduling,
lastFetchedInterval.Start.Date, lastFetchedInterval.End.Date);
}
}
}