The best way to do this is by using a BackgroundWorker
.
The reason I point this one out is it is specially designed to process work in the background while leaving the UI thread available and responsive. It also has built in Progress
notifications and supports Cancellation
.
I suggest looking at a few examples of a the BackgroundWorker.
Now when you start looking into the background worker there is one point Cancellation
that you will have to dig deeper into. Setting the cancel property of a background worker doesnt cancel the background worker, this just raises a flag for your running method to interogate at regular intervals and gracefully stop processing.
Here is one of my posts from awhile ago talking about cancelling a background worker https://mcmap.net/q/430080/-backgroundworker-questions-on-cancellation
Finally. Asyncronous does not mean multi-core or even multi-thread. (WIKI)