protected override void Dispose(bool disposing) { if (disposed) { return; } disposed = true; //... if (configFrm != null && !configFrm.IsDisposed) { configFrm.Close(); } if (errorList != null) { ((IDisposable)errorList).Dispose(); } if (spSolutionBM != null && _pdwCookieSolutionBM != 0) { spSolutionBM.UnadviseUpdateSolutionEvents(_pdwCookieSolutionBM); } if (spSolution != null && _pdwCookieSolution != 0) { spSolution.UnadviseSolutionEvents(_pdwCookieSolution); } base.Dispose(disposing); }
internal void Unregister() { // Unregister this object from IVsUpdateSolutionEvents events if (m_updateSolutionEventsCookie != VSCOOKIE_NIL) { IVsSolutionBuildManager2 buildManager = Package.GetService <SVsSolutionBuildManager, IVsSolutionBuildManager2>(); if (buildManager != null) { buildManager.UnadviseUpdateSolutionEvents(m_updateSolutionEventsCookie); m_updateSolutionEventsCookie = VSCOOKIE_NIL; } } // Unregister this object from IVsSolutionEvents events if (m_solutionEventsCookie != VSCOOKIE_NIL) { IVsSolution solution = Package.GetService <SVsSolution, IVsSolution>(); if (solution != null) { solution.UnadviseSolutionEvents(m_solutionEventsCookie); m_solutionEventsCookie = VSCOOKIE_NIL; } } // Unregister this object from IVsRunningDocTableEvents events if (m_runningDocTableEventsCookie != VSCOOKIE_NIL) { IVsRunningDocumentTable runningDocTable = Package.GetService <SVsRunningDocumentTable, IVsRunningDocumentTable>(); if (runningDocTable != null) { runningDocTable.UnadviseRunningDocTableEvents(m_runningDocTableEventsCookie); m_runningDocTableEventsCookie = VSCOOKIE_NIL; } } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); ThreadHelper.ThrowIfNotOnUIThread(); solutionBuildManager?.UnadviseUpdateSolutionEvents(solutionBuildManagerCookie); }
private void UnHookBuildEvents() { if (sbm != null && updateSolutionEventsCookie != 0) { sbm.UnadviseUpdateSolutionEvents(updateSolutionEventsCookie); } }
private void Dispose(bool disposing) { // Unadvise all events if (buildManager != null && eventsCookie != 0) { buildManager.UnadviseUpdateSolutionEvents(eventsCookie); } }
protected override void Dispose(bool disposing) { ThreadHelper.ThrowIfNotOnUIThread(); base.Dispose(disposing); if (_solutionService != null && _cookieHandle != 0) { _solutionService.UnadviseUpdateSolutionEvents(_cookieHandle); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); // Unadvise all events if (sbm != null && updateSolutionEventsCookie != 0) { sbm.UnadviseUpdateSolutionEvents(updateSolutionEventsCookie); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); // Unadvise all events if (_solutionBuildManager != null && _updateSolutionEventsCookie != 0) { _solutionBuildManager.UnadviseUpdateSolutionEvents(_updateSolutionEventsCookie); } }
protected override void Dispose(bool disposing) { ThreadHelper.ThrowIfNotOnUIThread(); base.Dispose(disposing); if (sbm != null && updateSolutionEventsCookie != 0) { sbm.UnadviseUpdateSolutionEvents(updateSolutionEventsCookie); } }
private void unadviseEvents() { if (spSolutionBM != null && _pdwCookieSolutionBM != 0) { spSolutionBM.UnadviseUpdateSolutionEvents(_pdwCookieSolutionBM); } if (spSolution != null && _pdwCookieSolution != 0) { spSolution.UnadviseSolutionEvents(_pdwCookieSolution); } }
private void UnsubscribeUpdateSolutionEvents() { if (_solutionBuildManager != null) { if (_updateSolutionEventsCookie != 0) { _solutionBuildManager.UnadviseUpdateSolutionEvents(_updateSolutionEventsCookie); _updateSolutionEventsCookie = 0; } _solutionBuildManager = null; } }
public void Dispose() { // Build manager APIs require UI thread access. _threadingService.ExecuteSynchronously(async() => { await _threadingService.SwitchToUIThread(); if (_buildManager != null) { // Unregister solution build events. _buildManager.UnadviseUpdateSolutionEvents(_solutionEventsCookie); _buildManager = null; } }); }
private bool disposedValue = false; // To detect redundant calls protected virtual void Dispose(bool disposing) { if (!disposedValue) { if (disposing) { // TODO: dispose managed state (managed objects). } if (solutionBuildManager != null && updateSolutionEventsCookie != 0) { solutionBuildManager.UnadviseUpdateSolutionEvents(updateSolutionEventsCookie); } disposedValue = true; } }
void IDisposable.Dispose() { ThreadHelper.ThrowIfNotOnUIThread(); OnUpdateSolutionDone = null; OnUpdateSolutionBegin = null; OnUpdateSolutionStartUpdate = null; OnActiveProjectConfigurationChange = null; OnUpdateSolutionCancel = null; OnUpdateProjectConfigDone = null; OnUpdateProjectConfigBegin = null; if (_cookie != 0) { var tempCookie = _cookie; _cookie = 0; ErrorHandler.ThrowOnFailure(_solutionBuildManager.UnadviseUpdateSolutionEvents(tempCookie)); } }
protected override void Dispose(bool disposing) { base.Dispose(disposing); // Unadvise all events if (vsShell != null && shellPropertyChangesCookie != 0) { vsShell.UnadviseShellPropertyChanges(shellPropertyChangesCookie); } if (sbm != null && updateSolutionEventsCookie != 0) { sbm.UnadviseUpdateSolutionEvents(updateSolutionEventsCookie); } if (solution != null && solutionEventsCookie != 0) { solution.UnadviseSolutionEvents(solutionEventsCookie); } }
void IDisposable.Dispose() { OnUpdateSolutionDone = null; OnUpdateSolutionBegin = null; OnUpdateSolutionStartUpdate = null; OnActiveProjectConfigurationChange = null; OnUpdateSolutionCancel = null; OnUpdateProjectConfigDone = null; OnUpdateProjectConfigBegin = null; if (cookie != 0) { var tempCookie = cookie; cookie = 0; var hresult = solutionBuildManager.UnadviseUpdateSolutionEvents(tempCookie); if (hresult != 0) { System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(hresult); } } }
protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing && _buildManager != null) { // Build manager APIs require UI thread access. _threadingService.ExecuteSynchronously(async() => { await _threadingService.SwitchToUIThread(); if (_buildManager != null) { // Unregister solution build events. _buildManager.UnadviseUpdateSolutionEvents(_solutionEventsCookie); _buildManager = null; } }); } _disposedValue = true; } }