Skip to Main Content
If we develop by .NET Remoting a .NET distributed application with a threaded client that has a user interface (UI) for a control of a distributed mechatronics system we have to often solve a problem of the responsiveness of its user interface. In a Windows Forms UI application all the code usually runs on a single thread known as the primary UI thread that is important because it is in charge of maintaining the responsiveness of the user interface. But how does our application respond when an asynchronous method call has finished executing and how do we update the user interface when an asynchronous call is finished? In this case we can take advantage of a handy feature of delegates that let us set up a callback method that is automatically executed by the common language runtime (CLR) when an asynchronous method call is completed. This paper shortly describes setting up a callback method by a delegate type named AsyncCallback that is defined by the Framework Class Library in the System namespace. In a conclusion the paper demonstrates the use of a callback method in the threaded client of sample distributed .NET application that was built in the Microsoft Visual Basic 2008 language and in the Microsoft Visual Studio 2008 development environment. By a callback method this client keeps the responsiveness of its user interface during executing an asynchronous call and updates the user interface when an asynchronous call is finished.