/// ------------------------------------------------------------------------------------ /// <summary> /// Destroy all divisions and pages /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; /// <c>false</c> to release only unmanaged resources.</param> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** "); // Must not be run more than once. Also don't call again while we're still in here // (which will happen because base.Dispose() calls DestroyHandle which will call // this.Dispose. if (IsDisposed || Disposing) return; if( disposing ) { if(components != null) components.Dispose(); // Even if disposing is false, we still dispose of our pages and and divisions // to force their rootboxes to close. // NOTE from RandyR: No. If it is false, // then the other disposable stuff may have been finalized already, // and accessing those kinds of objects will throw exceptions. DisposePages(); // also calls m_pages.Clear(); if (m_divisions != null) { foreach (DivisionLayoutMgr div in m_divisions) div.Dispose(); } if (m_divisions != null) m_divisions.Clear(); if (m_editingHelper != null) m_editingHelper.Dispose(); if (m_sharedStreams != null) { foreach (IVwRootBox rootb in m_sharedStreams) rootb.Close(); } if (m_screenGraphics != null) m_screenGraphics.Dispose(); if (m_printerGraphics != null) m_printerGraphics.Dispose(); if (m_Timer != null) m_Timer.Dispose(); } m_divisions = null; m_sharedStreams = null; components = null; m_editingHelper = null; m_screenGraphics = null; m_printerGraphics = null; m_Timer = null; base.Dispose(disposing); if (disposing) { if (m_sequencer != null) m_sequencer.Dispose(); } m_sequencer = null; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Destroy all divisions and pages /// </summary> /// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; /// <c>false</c> to release only unmanaged resources.</param> /// ------------------------------------------------------------------------------------ protected override void Dispose(bool disposing) { // Must not be run more than once. if (IsDisposed) return; if( disposing ) { if(components != null) components.Dispose(); // Even if disposing is false, we still dispose of our pages and and divisions // to force their rootboxes to close. // NOTE from RandyR: No. If it is false, // then the other disposable stuff may have been finalized already, // and accessing those kinds of objects will throw exceptions. DisposePages(); // also calls m_pages.Clear(); if (m_divisions != null) { foreach (DivisionLayoutMgr div in m_divisions) div.Dispose(); } if (m_divisions != null) m_divisions.Clear(); if (m_editingHelper != null) m_editingHelper.Dispose(); if (m_sharedStreams != null) { foreach (IVwRootBox rootb in m_sharedStreams) rootb.Close(); } if (m_screenGraphics != null) m_screenGraphics.Dispose(); if (m_printerGraphics != null) m_printerGraphics.Dispose(); if (m_Timer != null) m_Timer.Dispose(); } m_divisions = null; m_sharedStreams = null; components = null; m_editingHelper = null; m_screenGraphics = null; m_printerGraphics = null; m_Timer = null; base.Dispose(disposing); }