DoWork of BackgroundWorker is called twice when RunWorkerAsync is called once?

前端 未结 7 1311
情深已故
情深已故 2020-12-06 01:51

I have create a backgroundworker in an class it works, but if i call and wait until the end run, call it for the second time it will do the same process twice

i thin

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-06 02:01

    I removed the control from the designer and instantiate a new WorkerProcess in Code:

    example: var bwProcess = new BackgroundWorker();

    bwProcess.DoWork += new DoWorkEventHandler(bwProcess_DoWork);

    bwProcess.RunWorkerCompleted += bwProcess_RunWorkerCompleted;

提交回复
热议问题