OperationProgressChanged

EventHub.OperationProgressChanged event

索引或更新操作的进度更改时发生。

public event EventHandler<OperationProgressEventArgs> OperationProgressChanged;

例子

该示例演示了如何使用事件。

string indexFolder = @"c:\MyIndex\";
string documentsFolder = @"c:\MyDocuments\";

// 创建索引
Index index = new Index(indexFolder);

// 订阅事件
index.Events.OperationProgressChanged += (sender, args) =>
{
    Console.WriteLine("Last processed: " + args.LastDocumentPath);
    Console.WriteLine("Result: " + args.LastDocumentStatus);
    Console.WriteLine("Processed documents: " + args.TotalDocuments);
    Console.WriteLine("Progress percentage: " + args.ProgressPercentage);
};

// 索引指定文件夹中的文档
index.Add(documentsFolder);

也可以看看