In GUI programming there is exist some very common problem - if some operation takes too much time the GUI will become unresponsive. For example, if you want establish connection with a server, or fetch some data from database or a large file, this probably will take some time and if you perform this operation in the main thread your GUI will stuck. In order to keep your GUI responsive you need to run long-running operations on a separate thread. So far, in order to open a new thread we used Thread class or BackgroundWorker. Starting from .NET Framework 4.0 we have a Task class for this purpose.
If you already switched to Visual Studio 2012 with Framework 4.5 then read my previous post - C# Async Programming Example in WPF (Async, Await).
If you still working with Visual Studio 2010 Framework 4.0 then this post is for you.
Today I'll show how to build WPF application with background thread using Task Framework 4.0.