public async void IndexAsync(List <FileMeta> lst, LuceneIndex luceneIndex) { PptWorker worker = new PptWorker(); worker.PptApp = new Microsoft.Office.Interop.PowerPoint.Application(); //worker.PptApp.Visible = false; worker.luceneIndex = luceneIndex; System.Threading.Tasks.Task[] tasks = new System.Threading.Tasks.Task[lst.Count]; for (int i = 0; i < lst.Count; i++) { worker.fileMeta = lst[i]; tasks[i] = System.Threading.Tasks.Task.Run(() => DoAsync(worker)); } await System.Threading.Tasks.Task.WhenAll(tasks); sError = worker.sbErr.ToString(); worker.QuitApp(); }
public static void DoAsync(PptWorker worker) { worker.Add2Index(); }