ActionBlock<T>
exposes a Completion
property. That's a Task
which completes when the block has finished processing everything. So you can await that:
ab.Complete();
await ab.Completion;
MessageBox.Show("Complete");
I must admit I haven't used TPL Dataflow myself, but the examples suggest that should be okay.