Hello, I have a .Net Form application.
When a "Run" button is clicked it does some Big Loop and constantly updates the GUI.
In case during this loop the user checks a CheckBox
the loop should be halted (so the user can examine the details displayed a TextBox).
Afterwards, the user can click a Continue or Restart button.
How should I program that?
here is a code skeleton.
foreach (Object o in SomeBigList)
// do some calculations withe the object and update a TextBox.
// Pause the Loop and wait for further GUI operation - Continue or Run Again.
private void ContinueButton_Click(object sender, EventArgs e)
// Continue running the Loop.
private void RunButton_Click(object sender, EventArgs e)
// If the Loop is Paused then Exit from the Loop.
// Run again.