【发布时间】:2017-03-06 12:47:45
【问题描述】:
由于多种原因,我无法在后台工作程序中运行代码的主要部分,我可以在后台工作程序中运行加载对话框,但需要在执行主要代码部分后关闭对话框。我已经实现了以下内容,但我不确定如何在代码执行后强制关闭后台工作人员:
LoaderWorker = new BackgroundWorker();
//Loading is the Form
Loading Loader = new Loading("Daten Exportieren");
LoaderWorker.DoWork += (s, args) =>
{
//Show Loading Dialog
Loader.Show();
};
ExecuteMainTasks();
//Here i need to stop the backgroundworker after the method above is complete.
是否有后台工作人员的解决方案,或者我应该使用不同的方法来确保我不会锁定加载程序的 UI 线程。请记住...我无法在后台工作程序中执行主要代码,因此必须稍微向后管理。
谢谢。
【问题讨论】:
标签: c# multithreading backgroundworker