[英]Waiting the function to be done in windows phone
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
您可以使用
BackgroundWorker
运行需要一些时间才能在后台线程上执行的代码
See: How to use a BackgroundWorker 请参阅: 如何使用BackgroundWorker
The code that you want to run after the task has been complete can be placed in teh handler for the RunWorkerCompleted
event. 您可以将任务完成后要运行的代码放在
RunWorkerCompleted
事件的处理程序中。
you can make a event in your function. 您可以在函数中创建一个事件。 and += it .
和+ =它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.