protected virtual void ReportQueuedTasks()
{
// NOTE: This may run on a background thread!
// We need to output this on the main thread. We must use BeginInvoke because the main thread may not be pumping events yet.
BeginInvokeWithErrorMessage(this.serviceProvider, this.dispatcher, () =>
{
this.taskProvider.SuspendRefresh();
try
{
Func<ErrorTask> taskFunc;
while (this.taskQueue.TryDequeue(out taskFunc))
{
// Create the error task
ErrorTask task = taskFunc();
// Log the task
this.taskProvider.Tasks.Add(task);
}
}
finally
{
this.taskProvider.ResumeRefresh();
}
});
}