Пример #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Insert a book
        /// </summary>
        /// <returns>The new book</returns>
        /// ------------------------------------------------------------------------------------
        public IScrBook Do()
        {
            IScripture scr = m_cache.LangProject.TranslatedScriptureOA;
            int        hvoTitle;
            IScrBook   newBook = ScrBook.CreateNewScrBook(m_bookID, scr, out hvoTitle);

            m_bookHvo = newBook.Hvo;

            // Insert the new book title and set the book names
            newBook.InitTitlePara();
            newBook.Name.CopyAlternatives(newBook.BookIdRA.BookName);
            newBook.Abbrev.CopyAlternatives(newBook.BookIdRA.BookAbbrev);

            // Now insert the first section for the new book.
            ITsTextProps textProps = StyleUtils.CharStyleTextProps(ScrStyleNames.ChapterNumber,
                                                                   m_cache.DefaultVernWs);

            ScrSection.CreateScrSection(newBook, 0, scr.ConvertToString(1), textProps, false);

            // Do synchronize stuff
            if (FwApp.App != null)
            {
                FwApp.App.Synchronize(new SyncInfo(SyncMsg.ksyncReloadScriptureControl, 0, 0),
                                      m_cache);
            }

            // Use Redo for rest of sync'ing and updating book filter
            Redo(false);

            return(newBook);
        }
        public void DisableCompareBtn()
        {
            // Add Revelation, archive it and then remove it.
            int hvoTitle;

            Assert.IsNull(ScrBook.FindBookByID(m_cache, 66),
                          "Revelation should not be in the database. Restore the clean version of TestLangProj.");
            IScrBook        revelation = ScrBook.CreateNewScrBook(66, m_scr, out hvoTitle);
            ITsPropsFactory propFact   = TsPropsFactoryClass.Create();
            ITsTextProps    ttp        = propFact.MakeProps(ScrStyleNames.NormalParagraph, m_cache.DefaultVernWs, 0);

            ScrSection.CreateScrSection(revelation, 0, "Text for section", ttp, false);
            AddArchive("Revelation Archive", new List <int>(new int[] { revelation.Hvo }));
            m_scr.ScriptureBooksOS.Remove(m_scr.ScriptureBooksOS[3]);

            DummySavedVersionsDialog dlg = new DummySavedVersionsDialog(m_cache);
            TreeView tree = dlg.ArchiveTree;

            // Select the archive node that was just added.
            tree.SelectedNode = tree.Nodes[0];
            dlg.SimulateSelectEvent();

            // Check to make sure the Compare to Current Version button is disabled
            Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled, "The Compare to Current Version button should be disabled");

            // Select a book node.
            tree.SelectedNode = tree.Nodes[0].Nodes[0];
            dlg.SimulateSelectEvent();

            // Check to make sure the Diff button is still disabled if we select Philemon
            // after it is removed from the DB.
            Assert.IsFalse(dlg.ComparetoCurrentVersionBtn.Enabled,
                           "The Compare to Current Version button should still");
        }
Пример #3
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// This is a separate method so we can override for tests that use the in-memory cache.
 /// </summary>
 /// <param name="bookNum">The canonical book number.</param>
 /// <param name="hvoTitle">The HVO of the title of the newly created book.</param>
 /// <returns></returns>
 /// ------------------------------------------------------------------------------------
 protected virtual IScrBook CreateNewScrBook(int bookNum, out int hvoTitle)
 {
     return(ScrBook.CreateNewScrBook(bookNum, m_scr, out hvoTitle));
 }