摘要:常量。Worker=newBackgroundWorker();Constants.Worker。WorkerSupportsCancelation=true;Constants.Worker.DoWork+=委托{while(!Constants.Worker.CancellationPending){Thread.Sleep(1000);for(inti=0;i<P
Constants.Worker = new BackgroundWorker();
Constants.Worker.WorkerSupportsCancellation = true;
Constants.Worker.DoWork += delegate
{
while (!Constants.Worker.CancellationPending)
{
Thread.Sleep(1000);
for (int i = 0; i < ProgramStatus.ChannelCount; i++)
{
if (ProgramStatus.IsStopped[i])
{
pictureBoxs[i].Image = pictureBoxs[i].ErrorImage;
}
}
}
};
Constants.Worker.RunWorkerAsync();
Closing += delegate
{
Constants.Worker.CancelAsync();
};