我可以在 ViewModel 类中执行以下操作:
var inc = 100.0d / total;
Parallel.ForEach(enumeration, new ParallelOptions { MaxDegreeOfParallelism = 8 },
item =>
{
//Do Parallel Tasks
lock (ProgressLock)
{
WorkProgress += inc; //This raises a PropertyChanged event (binding).
}
});
我遇到的麻烦是让每个并行任务都响应 UI。任何帮助都会很棒。谢谢!