This is a migrated thread and some comments may be shown as answers.

RadScheduler and RadWaitingBar

3 Answers 129 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 2
Dario asked on 11 Jul 2015, 02:19 PM

Hi to all,

I need to show a WaitingBar during mapping my appointments. How can I do this?

Actually I have a custom control with this structure: a Panel that contains sequentially RadNavigator (Dock.Top) > RadScheduler (Dock.Fill) > RadWaiting (Dock.Bottom)

I can't set a DataSource directly to the database, I used a BindingList<CustomAppointment>

During intercept some event's scheduler and navigator, fire a my delegate event NeedData that asks to Windows program to execute load data for specific period.

In this case if items of my BindingList<CustomAppointment> contains a lot of items, the primary thread is freezing.

I would use a RadWaitingBar to show a "waiting period" to user.

How can I do this? Normally I resolve this problem.... but on WPF Application with RadBusyIndicator :-)

01.#region navigator events
02.void NavigatorNavigateForwardsClick(object sender, EventArgs e)
04. if (NeedData != null)
05.  NeedData(scheduler.ActiveView.StartDate, scheduler.ActiveView.EndDate);
06.}void NavigatorNavigateBackwardsClick(object sender, EventArgs e)
08. if (NeedData != null)
09.  NeedData(scheduler.ActiveView.StartDate, scheduler.ActiveView.EndDate);
10.}#endregion#region scheduler eventsvoid SchedulerActiveViewChanged(object sender, SchedulerViewChangedEventArgs e)
12. if (NeedData != null)
13.  NeedData(scheduler.ActiveView.StartDate, scheduler.ActiveView.EndDate);

01.// create and configure a scheduler binding source
02.schedulerBindingDatasource = new SchedulerBindingDataSource();
03.// map the MyAppointment properties to the scheduler
04.appointmentMappingInfo = new AppointmentMappingInfo();
05.appointmentMappingInfo.Start = "Start";
06.appointmentMappingInfo.End = "End";
07.appointmentMappingInfo.Summary = "Subject";
08.appointmentMappingInfo.Description = "Description";
09.appointmentMappingInfo.Location = "Location";
10.appointmentMappingInfo.UniqueId = "Id";
11.appointmentMappingInfo.Exceptions = "Exceptions";
12.appointmentMappingInfo.ResourceId = "ResourceId";
13.appointmentMappingInfo.StatusId = "StatusId";
14.appointmentMappingInfo.BackgroundId = "BackgroundId";
16.schedulerBindingDatasource.EventProvider.Mapping = appointmentMappingInfo;
17.// assign the generic List of CustomAppointment as the EventProvider data source
18.schedulerBindingDatasource.EventProvider.DataSource = customAppointments;
20.if (customResources != null)
21.    LoadCustomResources();
23.scheduler.DataSource = schedulerBindingDatasource;

3 Answers, 1 is accepted

Sort by
Ivan Todorov
Telerik team
answered on 15 Jul 2015, 01:03 PM
Hello Dario,

Thank you for contacting us.

Putting a time-consuming operation in a Click handler will execute the operation on the main UI thread and this will cause the interface of the application to "freeze". Also, the waiting bar needs the main thread unblocked in order to update properly (i.e. its indication will not move if the main thread is blocked). To handle this scenario, you need to move the time-consuming operation to a separate thread. The best way to achieve this is by using a background worker.

There are a few things to consider when using multi-threading and background worker in particular:
The DoWork event of the worker is executed on a background thread and the RunWorkerCompleted event is executed on the main thread.
You should not access or modify any UI components from the background thread and you should only be working with the data.
There is a built in mechanism for passing arguments to the DoWork event and passing the result to the RunWorkerCompleted event.

I am attaching a sample project which demonstrates how you can implement a similar scenario with a background worker. I hope you find it useful.

If you have any further questions, feel free to ask.

Ivan Todorov
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Top achievements
Rank 2
answered on 15 Jul 2015, 01:29 PM

Thank you for example, I will try it.

I will response you with news.

Top achievements
Rank 2
answered on 18 Jul 2015, 09:32 AM
Perfect! Thank you for all.
Scheduler and Reminder
Asked by
Top achievements
Rank 2
Answers by
Ivan Todorov
Telerik team
Top achievements
Rank 2
Share this question