private void HandleAnalysisCompleted(object sender, EventArgs e) { var percentageOfExpectedQuotesFound = PercentageOfExpectedQuotesFound(m_project.Books); if (percentageOfExpectedQuotesFound < Settings.Default.TargetPercentageOfQuotesFound) { using (var dlg = new PercentageOfExpectedQuotesFoundTooLowDlg(Text, percentageOfExpectedQuotesFound)) { MainForm.LogDialogDisplay(dlg); dlg.ShowDialog(); if (dlg.UserWantsToReview) { m_navigatorViewModel.BlockNavigator = new BlockNavigator(m_project.IncludedBooks); ShowTestResults(percentageOfExpectedQuotesFound, true); DisableForm(false); return; } } } else if (m_project.ProjectAnalysis.PercentUnknown > Settings.Default.MaxAcceptablePercentageOfUnknownQuotes) { using (var dlg = new TooManyUnexpectedQuotesFoundDlg(Text, m_project.ProjectAnalysis.PercentUnknown)) { MainForm.LogDialogDisplay(dlg); dlg.ShowDialog(); if (dlg.UserWantsToReview) { if (!m_toolStripComboBoxFilter.Items.Contains(m_allQuotesFilterItem)) { m_toolStripComboBoxFilter.Items.Insert(m_toolStripComboBoxFilter.Items.Count - 1, m_allQuotesFilterItem); } m_toolStripComboBoxFilter.SelectedItem = m_allQuotesFilterItem; DisableForm(false); return; } } } DialogResult = DialogResult.OK; Close(); }
private void HandleAnalysisCompleted(object sender, EventArgs e) { int totalExpectedQuotesInIncludedChapters = 0; int totalVersesWithExpectedQuotes = 0; var expectedQuotes = ControlCharacterVerseData.Singleton.ExpectedQuotes; foreach (var book in expectedQuotes.Keys) { var bookScript = m_project.Books.FirstOrDefault(b => BCVRef.BookToNumber(b.BookId) == book); if (bookScript == null) { continue; } foreach (var chapter in expectedQuotes[book]) { bool chapterCounted = false; foreach (var verseWithExpectedQuote in chapter.Value) { var referenceForExpectedQuote = new VerseRef(book, chapter.Key, verseWithExpectedQuote, ScrVers.English); referenceForExpectedQuote.ChangeVersification(m_project.Versification); var blocks = bookScript.GetBlocksForVerse(referenceForExpectedQuote.ChapterNum, referenceForExpectedQuote.VerseNum).ToList(); if (!chapterCounted && blocks.Any()) { totalExpectedQuotesInIncludedChapters += chapter.Value.Count; chapterCounted = true; } if (blocks.Any(b => b.IsQuote)) { totalVersesWithExpectedQuotes++; } } } } double percentageOfExpectedQuotesFound = totalVersesWithExpectedQuotes * 100.0 / totalExpectedQuotesInIncludedChapters; if (percentageOfExpectedQuotesFound < Properties.Settings.Default.TargetPercentageOfQuotesFound) { using (var dlg = new PercentageOfExpectedQuotesFoundTooLowDlg(Text, percentageOfExpectedQuotesFound)) { dlg.ShowDialog(); if (dlg.UserWantsToReview) { if (!m_toolStripComboBoxFilter.Items.Contains(m_versesWithMissingExpectedQuotesFilterItem)) { m_toolStripComboBoxFilter.Items.Insert(1, m_versesWithMissingExpectedQuotesFilterItem); } m_toolStripComboBoxFilter.SelectedItem = m_versesWithMissingExpectedQuotesFilterItem; return; } } } else if (m_project.ProjectAnalysis.PercentUnknown > Properties.Settings.Default.MaxAcceptablePercentageOfUnknownQuotes) { using (var dlg = new TooManyUnexpectedQuotesFoundDlg(Text, m_project.ProjectAnalysis.PercentUnknown)) { dlg.ShowDialog(); if (dlg.UserWantsToReview) { if (!m_toolStripComboBoxFilter.Items.Contains(m_allQuotesFilterItem)) { m_toolStripComboBoxFilter.Items.Insert(m_toolStripComboBoxFilter.Items.Count - 1, m_allQuotesFilterItem); } m_toolStripComboBoxFilter.SelectedItem = m_allQuotesFilterItem; return; } } } DialogResult = DialogResult.OK; Close(); }