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"); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// <param name="cache"></param> /// <param name="filter">book filter in place</param> /// <param name="bookID">ordinal ID of the book being removed</param> /// ------------------------------------------------------------------------------------ public UndoRemoveBookAction(FdoCache cache, FilteredScrBooks filter, int bookID) { m_cache = cache; m_bookFilter = filter; m_bookID = bookID; m_bookHvo = ScrBook.FindBookByID(m_cache, bookID).Hvo; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Reverses (or "un-does") an action. /// </summary> /// <param name="fRefreshPending">Ignored</param> /// ------------------------------------------------------------------------------------ public override bool Undo(bool fRefreshPending) { if (FwApp.App != null) { // find out the HVO of the book that is being restored. // We can't use m_bookHvo because if multiple users are connected with // this database the HVO might already be gone. IScrBook book = ScrBook.FindBookByID(m_cache, m_bookID); m_bookHvo = book.Hvo; FwApp.App.Synchronize(new SyncInfo(SyncMsg.ksyncScriptureDeleteBook, m_bookHvo, (int)Scripture.ScriptureTags.kflidScriptureBooks), m_cache); } return(true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Redoes the Insert Book - the book is being added /// </summary> /// <param name="fRefreshPending">Ignored</param> /// ------------------------------------------------------------------------------------ public override bool Redo(bool fRefreshPending) { // find out the HVO of the book that is being restored. // We can't use m_bookHvo because if multiple users are connected with // this database the HVO might already be gone. IScrBook book = ScrBook.FindBookByID(m_cache, m_bookID); m_bookHvo = book.Hvo; if (FwApp.App != null) { FwApp.App.Synchronize(new SyncInfo(SyncMsg.ksyncScriptureNewBook, m_bookHvo, (int)Scripture.ScriptureTags.kflidScriptureBooks), m_cache); } m_bookFilter.UpdateFilter(m_bookHvo); m_bookFilter.Load(m_bookHvo, m_bookFilter.Tag, m_cache.DefaultVernWs, m_cache.VwCacheDaAccessor); return(true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Handle a selection change in the tree view. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// ------------------------------------------------------------------------------------ protected void m_treeArchives_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { bool enableCompare = false; // Enable the Delete, Diff and Copy to Current buttons based on whether the selection is on // a book node and whether the corresponding book is present in the current version. TreeNode node = m_treeArchives.SelectedNode; m_btnDelete.Enabled = (node != null); if (node != null && node.Tag is ScrBook) { m_btnDelete.Enabled = m_btnCopyToCurr.Enabled = true; int bookId = ((ScrBook)node.Tag).CanonicalNum; IScrBook sameBookInDB = ScrBook.FindBookByID(m_scr, bookId); enableCompare = (sameBookInDB != null); } else { m_btnCopyToCurr.Enabled = false; } m_btnDiff.Enabled = enableCompare; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates a Back Translation for the stuff in Exodus with the following layout: /// /// () /// BT Heading 1 /// BT Intro text /// BT Heading 2 /// (1)1BT Verse one. /// /// (1) = chapter number 1 /// </summary> /// ------------------------------------------------------------------------------------ protected void CreatePartialExodusBT(int wsAnal) { IScrBook book = ScrBook.FindBookByID(m_scr, 2); IScrSection section = book.SectionsOS[0]; ScrTxtPara para = new ScrTxtPara(Cache, section.HeadingOA.ParagraphsOS.HvoArray[0]); CmTranslation trans = (CmTranslation)para.GetOrCreateBT(); m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "BT Heading 1", null); para = new ScrTxtPara(Cache, section.ContentOA.ParagraphsOS.HvoArray[0]); trans = (CmTranslation)para.GetOrCreateBT(); m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "BT Intro text", null); section = book.SectionsOS[1]; para = new ScrTxtPara(Cache, section.HeadingOA.ParagraphsOS.HvoArray[0]); trans = (CmTranslation)para.GetOrCreateBT(); m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "BT Heading 2", null); para = new ScrTxtPara(Cache, section.ContentOA.ParagraphsOS.HvoArray[0]); trans = (CmTranslation)para.GetOrCreateBT(); m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "1", ScrStyleNames.ChapterNumber); m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "1", ScrStyleNames.VerseNumber); m_scrInMemoryCache.AddRunToMockedTrans(trans, wsAnal, "BT Verse one", null); }