How to wait until BackgroundWorker finish all calls

前端 未结 4 673
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-26 10:30

I have Add button click event how add file:

private void btnAddfiles_Click(object sender, EventArgs e)
{
    if (openFileDialog1.ShowDialog() == Sys         


        
4条回答
  •  南方客
    南方客 (楼主)
    2021-01-26 10:52

    To prevent UI freezing, you can do this:

    while (BackgroundWorker.IsBusy()) {
        Application.DoEvents();
    }
    

    I go this from the msdn docs, here

提交回复
热议问题