|
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)
- {
- }
复制代码
|
|