I want to prevent a button click from queuing. In testing I have a Form, a Button and in the Code-Behind I have the event handler:
private void button1_C
I had a button that on click event was going to run a method. Same issue happent and when the user clicked multiple times the method was triggered multiple times. So I made a boolean and changed it value when the method started.
private bool IsTaskRunning = false
private void MyMethod(){
if(IsTaskRunning==false){
IsTaskRunning=true;
//My heavy duty code that takes a long time
IsTaskRunning=false; //When method is finished
}
}
So now the method runs only if it's done the last time.