Here. “[O]ne thing doesn’t make users happy—not having full control of any processing that their applications are performing. Even though the UI is responsive while pi is being calculated, the user would still like the option to cancel the calculation if they’ve decided they need 1,000,001 digits and they mistakenly asked for only 1,000,000.”
In this article, I add canceling to my asynchronous pi calculating WinForms app.