Make a BackgroundWorker do several operations sequentially without freezing the form

前端 未结 4 875
醉酒成梦
醉酒成梦 2020-12-01 22:51

I have already asked a somwhat similar question here but I now have a follow-up question.

I need to launch the external program several times in a row, but I have se

4条回答
  •  长情又很酷
    2020-12-01 23:37

    The solution is simple: have one BGW execute all of the commands, not just one BGW for each command. You'll need a List to store the commands so you can easily pass them to RunWorkerAsync(). DoWork() can simply iterate the list with foreach.

提交回复
热议问题