corelibraries-devexpress-dot-xtrascheduler-73237c56.md
Provides data for the SchedulerStorageBase.FetchAppointments event.
Namespace : DevExpress.XtraScheduler
Assembly : DevExpress.XtraScheduler.v25.2.Core.dll
NuGet Package : DevExpress.Scheduler.Core
public class TimeIntervalEventArgs :
EventArgs
Public Class TimeIntervalEventArgs
Inherits EventArgs
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.
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);
}
}
}
Public Partial Class Form1
Inherits Form
Private lastFetchedInterval As TimeInterval = New TimeInterval()
' ...
Private Sub schedulerStorage1_FetchAppointments(ByVal sender As Object, _
ByVal e As DevExpress.XtraScheduler.FetchAppointmentsEventArgs)
Dim start As DateTime = e.Interval.Start
Dim [end] As DateTime = e.Interval.End
' Check if the requested interval is outside lastFetchedInterval
If start <= lastFetchedInterval.Start OrElse [end] >= lastFetchedInterval.End Then
lastFetchedInterval = New TimeInterval(start - TimeSpan.FromDays(7), _
[end] + TimeSpan.FromDays(7))
carSchedulingTableAdapter.FillBy(Me.carsDBDataSet.CarScheduling, _
lastFetchedInterval.Start.Date, lastFetchedInterval.End.Date)
End If
End Sub
End Class
Object EventArgs TimeIntervalEventArgs FetchAppointmentsEventArgs
See Also