I haven't done multi-threading before, so I need a bit of help with this.
I have a form with a button. When user clicks on a button for the first time, a recursive function is called. When a certain condition in the function is true, I want the function to wait where it's at for the next button click.
An example:
void ButtonClick(object sender, EventArgs e) { if (running) { //notify the thread (the recursive function) to continue
}
else functionCall(0); }
void functionCall(int num) {
if (num % 2 == 0)
{
displaySomething();
//wait
}
functionCall(num + 1); }
|
How would I do this?