BackgroundWorker使用
BackgroundWorker使用(1)
BackgroundWorker mWorker = new BackgroundWorker();
mWorker.WorkerSupportsCancellation = true;
mWorker.DoWork += new DoWorkEventHandler(SumX);
//mWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(xxx);
mWorker.RunWorkerAsync(); private void SumX(object sender, DoWorkEventArgs e)
{
}(2)
BackgroundWorker mWorker = new BackgroundWorker();
mWorker.WorkerSupportsCancellation = true;
mWorker.DoWork += (o, ea) =>
{
SumX(x);
};
//mWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(xxx);
mWorker.RunWorkerAsync(); private void SumX(string x)
{
}(3)<T>在当前为NPOI.SS.Formula.Function.T BackgroundWorker mWorker = new BackgroundWorker();
mWorker.WorkerSupportsCancellation = true;
mWorker.DoWork += (o, ea) =>
{
SumX<T>(x);
};
//mWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(xxx);
mWorker.RunWorkerAsync(); private void SumX<T>(string x)
{
}
页:
[1]