private void btReindexCorpus_Click(object sender, RoutedEventArgs e) { Indexation_ViewModel indexation_vm = new Indexation_ViewModel(indexer_worker); indexer_worker.RunWorkerAsync(new Tuple <Corpora_ViewModel, Indexation_ViewModel>((Corpora_ViewModel)DataContext, indexation_vm)); busy_with_indexing = new BusyWithIndexing(indexation_vm); busy_with_indexing.Owner = this; busy_with_indexing.ShowDialog(); }
public void ReindexSelectedCorpus(BackgroundWorker worker, Indexation_ViewModel indexation_vm, out bool cancelled) { cancelled = false; log4net.ILog log = log4net.LogManager.GetLogger(typeof(Corpora_ViewModel)); if (selected_corpus != null) { try { log.InfoFormat("Start indexing the corpus id={0} caption={1}", selected_corpus.Id, selected_corpus.Caption); indexation_vm.IndexingProgress = "Indexation of " + selected_corpus.Caption; FullTextIndex.CorpusIndexer indexer = new FullTextIndex.CorpusIndexer(); CancelIndexationFromWorker cancellation = new CancelIndexationFromWorker(worker); IndexationProgressWithWorker progress = new IndexationProgressWithWorker(worker); indexer.BuildIndex(GetIndexFolder(selected_corpus), selected_corpus.TxtFilesPath, CorpusFormat.CorpusFormatDecriptor.ParseJSON(selected_corpus.CorpusFormat), cancellation, progress); cancelled = cancellation.Cancelled; using (var db_session = session_factory.OpenSession()) { using (var tx = db_session.BeginTransaction()) { selected_corpus.IndexDate = DateTime.Now; db_session.Update(selected_corpus); tx.Commit(); log.Info("tx.Commit OK"); PropertyChanged(this, new PropertyChangedEventArgs("CorpusInfos")); } } } catch (Exception ex) { log.Error(ex); } } }
public BusyWithIndexing(Indexation_ViewModel data_context) { InitializeComponent(); DataContext = data_context; }