change - 循环方法添加线程

master
SoulStar 3 months ago
parent b3430a6e54
commit dc02eb7667

@ -69,11 +69,15 @@ namespace NDSD_Screwdriver
MessageBox.Show("属性值无效!"); MessageBox.Show("属性值无效!");
return; return;
} }
for (int i = 0; i <= 16; i++) Thread thread = new Thread(() =>
{ {
DOperate.DClose(i); for (int i = 0; i <= 16; i++)
Thread.Sleep(span); {
} DOperate.DClose(i);
Thread.Sleep(span);
}
});
thread.Start();
} }
private void DOpenAll_Click(object sender, EventArgs e) private void DOpenAll_Click(object sender, EventArgs e)
@ -85,11 +89,15 @@ namespace NDSD_Screwdriver
MessageBox.Show("属性值无效!"); MessageBox.Show("属性值无效!");
return; return;
} }
for (int i = 0; i <= 16; i++) Thread thread = new Thread(() =>
{ {
DOperate.DOpen(i); for (int i = 0; i <= 16; i++)
Thread.Sleep(span); {
} DOperate.DOpen(i);
Thread.Sleep(span);
}
});
thread.Start();
} }
private void ScrewdriverTest_FormClosed(object sender, FormClosedEventArgs e) private void ScrewdriverTest_FormClosed(object sender, FormClosedEventArgs e)
@ -118,11 +126,15 @@ namespace NDSD_Screwdriver
MessageBox.Show("属性值无效!"); MessageBox.Show("属性值无效!");
return; return;
} }
for (int i = 0; i <= 16; i++) Thread thread = new Thread(() =>
{ {
DOperate.DTimeOpen(i, time); for (int i = 0; i <= 16; i++)
Thread.Sleep(span); {
} DOperate.DTimeOpen(i, time);
Thread.Sleep(span);
}
});
thread.Start();
} }
} }

Loading…
Cancel
Save