Using RadWaitingBar to indicate the status of long-running operations
Product | Author |
---|---|
RadWaitingBar for WinForms | Boyko Markov |
HOW-TO
Use RadWaitingBar to indicate the status of long-running operations
SOLUTION
The Waiting bar is a very useful control for indicating the status of a long running operation. However, there is a general problem with waiting bars, which relates to using the control on the same thread where the operation is running. Basically the waiting bar does not validate the operation's progress and does not move (seems to be frozen).
The obvious solution is to start the long operation in a new thread. A good example of this can be establishing a telnet session and indicating the process with the waiting bar control.
Do the following:
- Drag and drop a new instance of RadWaitingBar from your toolbox to the form.
- Drag and drop a new instance of RadButton from the toolbox. We will use the button to start our long operation. It will also start our waiting bar.
- We will start the task in an instance of the TelnetTask class in a new thread by calling the StartTelnetTask method. Here is the source of TelnetTask class:
4.Finally, handle the click event of the button as follows: