예제 #1
0
        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;
            });
        }
예제 #2
0
        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;
            });
        }