I have 2 button click events.
void Button1_click(...)
{
//Do somethings
Foo();
}
void Button2_Click(...)
{
//Do somethings
Foo();
}
The function Foo() take more than 1 minutes to finished.
When I click on button1, and after that I click button2. How can I stop Foo() in Button1_click and run only Foo() on Button2_click?