Constants.Worker = new BackgroundWorker();
Constants.Worker.WorkerSupportsCancellation = true;
Constants.Worker.DoWork += delegate
{
while (!Constants.Worker.CancellationPending)
{
Thread.Sleep();
for (int i = ; i < ProgramStatus.ChannelCount; i++)
{
if (ProgramStatus.IsStopped[i])
{
pictureBoxs[i].Image = pictureBoxs[i].ErrorImage;
}
}
}
};
Constants.Worker.RunWorkerAsync();
Closing += delegate
{
Constants.Worker.CancelAsync();
};