In this article I go over using the background worker control in C# .NET Framework (Visual Studio 2015). This control allows you to easily do processing intensive tasks without locking up your interface thread. I use this a lot in winforms applications where I expect code to take any amount of time that the user would notice the interface being locked up while processing. This control gives you the ability to send progress updates to the interface thread as well as cancel processing any any time. The code for this example is on my GitHub here. https://www.youtube.com/watch?v=PKKRAyn3TTs Here is the important code from the main form: public enum CurrentStatus { None, Reset, Loading, Cancelled, Success, Busy } public class MainForm : Form { private BackgroundWorker bwInstance; private Button btnStartWorker; private Button btnStopWorker; private Label lblLoadingStatus; private ProgressBar prgLoadingProgress; private CurrentStatus processin...
Computers, programming, software development, AI, design, and more!