I have a data bound scheduler, with a SchedulerBindingSource:
I use async await to get appointments from the database, and on this background thread I also add the appointments to a binding list.
After this work is done I want to update the scheduler by adding the binding list from the background thread to the scheduler's binding list on the UI thread.
This doesn't fire the Appointments_CollectionChanged event, and the scheduler is not updated
Is there a way to do this in one go? I've done some investigation, and updating the scheduler one appointment at a time seems to fire the Appointments_CollectionChanged event, but this is very time consuming. Another option is to call the InitiateBookingDataSource() method again, but I don't like that solution either.
Regards, Jill-Connie Lorentsen
private void InitiateBookingDataSource()
{
if (_appointmentBookings == null) _appointmentBookings = new BindingList<
Booking
>();
var dataSource = new SchedulerBindingDataSource();
var mappingInfo = new AppointmentMappingInfo
{
Start = "StartTime",
End = "EndTime",
Summary = "BookingSubject",
Description = "BookingDescription",
BackgroundId = "BackgroundId",
AllDay = "AllDay",
RecurrenceRule = "RecurrenceRule",
Exceptions = "Exceptions",
MasterEventId = "MasterEventId",
Visible = "Visible"
};
mappingInfo.Mappings.Add(new SchedulerMapping("CaseId", "CaseId"));
mappingInfo.Mappings.Add(new SchedulerMapping("PratId", "PratId"));
mappingInfo.Mappings.Add(new SchedulerMapping("InterpretorId", "InterpretorId"));
mappingInfo.Mappings.Add(new SchedulerMapping("BoothId", "BoothId"));
mappingInfo.Mappings.Add(new SchedulerMapping("CaseDesc", "CaseDesc"));
mappingInfo.Mappings.Add(new SchedulerMapping("InterpretorDesc", "InterpretorDesc"));
mappingInfo.Mappings.Add(new SchedulerMapping("BoothDesc", "BoothDesc"));
dataSource.EventProvider.Mapping = mappingInfo;
dataSource.EventProvider.DataSource = _appointmentBookings;
dataSource.EventProvider.AppointmentFactory = rsBookings.AppointmentFactory;
rsBookings.DataSource = dataSource;
}
I use async await to get appointments from the database, and on this background thread I also add the appointments to a binding list.
After this work is done I want to update the scheduler by adding the binding list from the background thread to the scheduler's binding list on the UI thread.
_appointmentBookings = await GetDataAsync(_cancellation.Token);
Is there a way to do this in one go? I've done some investigation, and updating the scheduler one appointment at a time seems to fire the Appointments_CollectionChanged event, but this is very time consuming. Another option is to call the InitiateBookingDataSource() method again, but I don't like that solution either.
Regards, Jill-Connie Lorentsen