Beispiel #1
0
        public void DefaultToSingleVoice_TooComplexToAssignAccurately_ReturnsTrue(string bookCode)
        {
            SingleVoiceReason singleVoiceReason;

            Assert.True(BookMetadata.DefaultToSingleVoice(bookCode, out singleVoiceReason));
            Assert.AreEqual(SingleVoiceReason.TooComplexToAssignAccurately, singleVoiceReason);
        }
        private void BtnOk_Click(object sender, EventArgs e)
        {
            List <BookScript> booksToAskUserAbout = new List <BookScript>();

            foreach (var book in m_project.AvailableBooks)
            {
                book.IncludeInScript = m_includeInScript[book.Code];

                if (!book.IncludeInScript)
                {
                    continue;
                }

                var bookScript = m_project.IncludedBooks.Single(b => b.BookId == book.Code);
                if (bookScript.SingleVoice != m_multiVoice[book.Code])
                {
                    continue;
                }

                SingleVoiceReason singleVoiceReason;
                if (m_multiVoice[book.Code] && BookMetadata.DefaultToSingleVoice(book.Code, out singleVoiceReason) && singleVoiceReason == SingleVoiceReason.TooComplexToAssignAccurately)
                {
                    booksToAskUserAbout.Add(bookScript);
                    continue;
                }

                bookScript.SingleVoice = !m_multiVoice[book.Code];
                Analytics.Track("SetSingleVoice", new Dictionary <string, string>
                {
                    { "book", book.Code },
                    { "singleVoice", bookScript.SingleVoice.ToString() },
                    { "method", "ScriptureRangeSelectionDlg.m_btnOk_Click" }
                });
            }

            if (booksToAskUserAbout.Any() && !ConfirmSetToMultiVoice(booksToAskUserAbout))
            {
                DialogResult = DialogResult.None;
                return;
            }

            m_project.BookSelectionStatus = BookSelectionStatus.Reviewed;

            Analytics.Track("SelectBooks", new Dictionary <string, string> {
                { "bookSummary", m_project.BookSelectionSummary }
            });
        }