c# - how to stop old event when new event is occurs -
i have 2 button click events.
void button1_click(...) { //do somethings foo(); } void button2_click(...) { //do somethings foo(); }
the function foo() take more 1 minutes finished.
when click on button1, , after click button2. how can stop foo() in button1_click , run foo() on button2_click?
you should run foo on separate thread, , invoke update on ui thread once complete use cancelation token stop given operation @ time. similar post here how update gui thread in c#?
Comments
Post a Comment