Integrate with services and a RadWindow
This tutorial will show you how to apply a RadBusyIndicator while a long distance calls are being in progress.
One way to achieve this is to make the time consuming service calls in a separate thread. To accomplish this you can use the BackgroundWorker class.
This topic will create a RadWindow control containing a RadGridView and a Button. Pressing the button will reproduce a service call which will retrieve some data. Later when the data is available it will be loaded into the RadGridView and while the call is in progress the RadBusyIndicator will be shown to indicate the ongoing process.
Here is a snapshot of the final result:
- The first thing you have to do is to declare the RadWindow and set its content to be the RadBusyIndicator content control as long as you want to show the indicator over the RadWindow control.
We will create RadWindow as a user control, the approach is explained in details here.
RadWindow declaration
Here is the sample data that is going to be retrieved:
Retrieved sample data
EmployeeService class
-
In code you can use the BackgroundWorker to make your service calls in a different thread:
Handle the DoWork event to make the time consuming call.
Handle the RunWorkerCompleted event to disable the RadBusyIndicator and show the result.
In order to use the BackgroundWorker you will have to add the following using/import in your code:
- System.ComponentModel
BackgroundWorker usage
- Then just open the RadWindow:
Open RadWindow
Here is the final result: