Asynchronous tasks on Winform

The problem

When you create winform applications, doing tasks in the background is essential to avoid user frustation. Unfortunatly, it could make you write a lot more code. Here are some utility methods that reduce the complexity of asynchronous calls within windows forms.

Within you base class

You probably have a common base class for all your UI components. Add these methods :

Within your UI classes

Now the only thing you need to do is to encapsulate the methode content with the Async() method :

The traditional way

Just in case you didn’t get it. This is what you should NOT DO:

Happy coding !