当我的backgroundworker线程中止时如何捕获?

时间:2013-02-22 13:25:01

标签: c# .net backgroundworker

.disposed事件处理程序会选择它吗?我似乎无法弄清楚如何分配这个事件处理程序 - 这就是我分配其他事件处理程序的方式:

            bw.ProgressChanged += new ProgressChangedEventHandler(
            delegate(object o, ProgressChangedEventArgs args)
            {
                lb_status.Text = args.ProgressPercentage.ToString() + "%";
                this.Refresh();
            });
            bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(
            delegate(object o, RunWorkerCompletedEventArgs args)
            {
                lb_status.Text = "Ready";
                BindingSource source = new BindingSource();
                source.DataSource = ds.Tables[0];
                dataGridView1.DataSource = source;
                source.ResetBindings(false);
                button1.Enabled = true;
            });

我在try / catch期间使用System.Threading.Thread.CurrentThread.Abort()中止线程。

0 个答案:

没有答案