There is a function like this:
public MImage ImageHandler (parameter){
// do something
}
This function will take some time depending on the parameter, now I want to monitor the execution of this function and do something after the function is done, like this:
//call this function
Task task = new task(ImageHandler(parameter));
task.begin();
task.done +=(()={ // do something after the function is done});
So How can I make it out?
Thanks in advance.
You can run your code that takes some time to execute on a background thread using a BackgroundWorker
See: How to use a BackgroundWorker
The code that you want to run after the task has been complete can be placed in teh handler for the RunWorkerCompleted
event.
you can make a event in your function. and += it .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.