public virtual void TearDown() { if (m_fdoCache != null) { UndoResult ures = 0; while (m_fdoCache.CanUndo) { m_fdoCache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures.ToString()); } } } if (m_division != null) { m_division.m_hPagesBroken.Clear(); m_division.Dispose(); m_division = null; } // Make sure we close all the rootboxes if (m_ScrPubCtrl != null) { m_ScrPubCtrl.Dispose(); m_ScrPubCtrl = null; } }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. if (m_cache != null) { UndoResult ures = 0; while (m_cache.CanUndo) { m_cache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures.ToString()); } } m_cache.Dispose(); } } // Dispose unmanaged resources here, whether disposing is true or false. m_cache = null; m_styleSheet = null; base.Dispose(disposing); }
public void CleanUp() { CheckDisposed(); UndoResult ures = 0; while (m_fdoCache.CanUndo) { m_fdoCache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures.ToString()); } } }
public void Destroy() { UndoResult ures = 0; while (m_cache.CanUndo) { m_cache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures.ToString()); } } m_cache.Dispose(); m_cache = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Undo everything possible in the FDO cache /// </summary> /// ------------------------------------------------------------------------------------ protected virtual void UndoEverythingPossible() { if (m_fdoCache != null) { using (new IgnorePropChanged(m_fdoCache, PropChangedHandling.SuppressAll)) { UndoResult ures = 0; while (m_fdoCache.CanUndo) { m_fdoCache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures.ToString()); } } } } }
public virtual void CleanUp() { CheckDisposed(); UndoResult ures = 0; while (m_fdoCache.CanUndo) { m_fdoCache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures.ToString()); } } // Some tests are not at all happy to have m_basicView be disposed befroe the undoing. m_basicView.Dispose(); m_basicView = null; m_fdoCache.Dispose(); m_fdoCache = null; }
/// <summary> /// Executes in two distinct scenarios. /// /// 1. If disposing is true, the method has been called directly /// or indirectly by a user's code via the Dispose method. /// Both managed and unmanaged resources can be disposed. /// /// 2. If disposing is false, the method has been called by the /// runtime from inside the finalizer and you should not reference (access) /// other managed objects, as they already have been garbage collected. /// Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing"></param> /// <remarks> /// If any exceptions are thrown, that is fine. /// If the method is being done in a finalizer, it will be ignored. /// If it is thrown by client code calling Dispose, /// it needs to be handled by fixing the bug. /// /// If subclasses override this method, they should call the base implementation. /// </remarks> protected override void Dispose(bool disposing) { //Debug.WriteLineIf(!disposing, "****************** " + GetType().Name + " 'disposing' is false. ******************"); // Must not be run more than once. if (IsDisposed) { return; } if (disposing) { // Dispose managed resources here. // Dispose window first, as it needs the cache to clear out its notification. if (m_mainWnd != null) { m_mainWnd.Dispose(); } if (m_cache != null) { UndoResult ures = 0; while (m_cache.CanUndo) { m_cache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures.ToString()); } } m_cache.Dispose(); // Yes, since the window isn't supposed to do it. } } // Dispose unmanaged resources here, whether disposing is true or false. m_cache = null; m_mainWnd = null; m_scr = null; // Restore prompt setting Options.ShowEmptyParagraphPromptsSetting = m_saveShowPrompts; // Options is some kind of Registry gizmo. base.Dispose(disposing); }
public void FDOCompetingTransactions() { CheckDisposed(); FdoCache a = FdoCache.Create("TestlangProj"); AddWord(a); UndoResult ures_a = 0; while (a.CanUndo) { a.Undo(out ures_a); if (ures_a == UndoResult.kuresFailed || ures_a == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures_a.ToString()); } } a.Dispose(); FdoCache b = FdoCache.Create("TestlangProj"); AddWord(b); UndoResult ures_b = 0; while (b.CanUndo) { b.Undo(out ures_b); if (ures_b == UndoResult.kuresFailed || ures_b == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures_b.ToString()); } } b.Dispose(); }
public void CleanUp() { CheckDisposed(); UndoResult ures = 0; while (m_cache.CanUndo) { m_cache.Undo(out ures); if (ures == UndoResult.kuresFailed || ures == UndoResult.kuresError) { Assert.Fail("ures should not be == " + ures.ToString()); } } // Don't dispose the cache, until after the window closes, as it needs it // to clear its notification from the cache. // m_mainWnd.Hide(); m_mainWnd.Close(); // m_mainWnd.Dispose(); // Not needed, since Close calls Dispose. m_mainWnd = null; m_cache.Dispose(); m_cache = null; }