private void BinaryAlgoIndexing(IIndexer indexer, object setting) { FileInfo[] imageFiles = getFiles(IndexDirectory, "*.gif|*.jpg|*.png|*.bmp|*.jpeg", SearchOption.TopDirectoryOnly); int totalFileCount = imageFiles.Length; Dispatcher.Invoke((Action) delegate { pbIndex.Minimum = 0; pbIndex.Maximum = totalFileCount; lblIndexStatus.Text = "Indexing.."; }); if (indexer != null) { _stopWatch = Stopwatch.StartNew(); if (ExecInParallel) { indexer.IndexFilesAsync(imageFiles, IndexBgWorker, setting); } else { indexer.IndexFiles(imageFiles, IndexBgWorker, setting); } _stopWatch.Stop(); } long timeElapse = _stopWatch.ElapsedMilliseconds; Dispatcher.Invoke((Action) delegate { lblIndexStatus.Text = string.Format("Indexing completed, it tooked {0} ms to index", timeElapse); btnIndex.IsEnabled = true; }); }
private void BinaryAlgoIndexing(IIndexer indexer, object setting) { FileInfo[] imageFiles = getFiles(IndexDirectory, "*.gif|*.jpg|*.png|*.bmp|*.jpeg", SearchOption.TopDirectoryOnly); int totalFileCount = imageFiles.Length; Dispatcher.Invoke((Action)delegate { pbIndex.Minimum = 0; pbIndex.Maximum = totalFileCount; lblIndexStatus.Text = "Indexing.."; }); if (indexer != null) { _stopWatch = Stopwatch.StartNew(); if (ExecInParallel) indexer.IndexFilesAsync(imageFiles, IndexBgWorker, setting); else indexer.IndexFiles(imageFiles, IndexBgWorker, setting); _stopWatch.Stop(); } long timeElapse = _stopWatch.ElapsedMilliseconds; Dispatcher.Invoke((Action)delegate { lblIndexStatus.Text = string.Format("Indexing completed, it tooked {0} ms to index", timeElapse); btnIndex.IsEnabled = true; }); }