コード例 #1
0
        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);
        }
コード例 #2
0
        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;
                }
            }
        }
コード例 #3
0
        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);
     }
 }
コード例 #5
0
ファイル: BuildEvents.cs プロジェクト: vukis/VSExtensions
 private void Dispose(bool disposing)
 {
     // Unadvise all events
     if (buildManager != null && eventsCookie != 0)
     {
         buildManager.UnadviseUpdateSolutionEvents(eventsCookie);
     }
 }
コード例 #6
0
        protected override void Dispose(bool disposing)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            base.Dispose(disposing);

            if (_solutionService != null && _cookieHandle != 0)
            {
                _solutionService.UnadviseUpdateSolutionEvents(_cookieHandle);
            }
        }
コード例 #7
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            // Unadvise all events
            if (sbm != null && updateSolutionEventsCookie != 0)
            {
                sbm.UnadviseUpdateSolutionEvents(updateSolutionEventsCookie);
            }
        }
コード例 #8
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            // Unadvise all events
            if (_solutionBuildManager != null && _updateSolutionEventsCookie != 0)
            {
                _solutionBuildManager.UnadviseUpdateSolutionEvents(_updateSolutionEventsCookie);
            }
        }
コード例 #9
0
        protected override void Dispose(bool disposing)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            base.Dispose(disposing);

            if (sbm != null && updateSolutionEventsCookie != 0)
            {
                sbm.UnadviseUpdateSolutionEvents(updateSolutionEventsCookie);
            }
        }
コード例 #10
0
        private void unadviseEvents()
        {
            if (spSolutionBM != null && _pdwCookieSolutionBM != 0)
            {
                spSolutionBM.UnadviseUpdateSolutionEvents(_pdwCookieSolutionBM);
            }

            if (spSolution != null && _pdwCookieSolution != 0)
            {
                spSolution.UnadviseSolutionEvents(_pdwCookieSolution);
            }
        }
コード例 #11
0
        private void UnsubscribeUpdateSolutionEvents()
        {
            if (_solutionBuildManager != null)
            {
                if (_updateSolutionEventsCookie != 0)
                {
                    _solutionBuildManager.UnadviseUpdateSolutionEvents(_updateSolutionEventsCookie);
                    _updateSolutionEventsCookie = 0;
                }

                _solutionBuildManager = null;
            }
        }
コード例 #12
0
        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;
                }
            });
        }
コード例 #13
0
        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;
            }
        }
コード例 #14
0
            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));
                }
            }
コード例 #15
0
        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);
            }
        }
コード例 #16
0
            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);
                    }
                }
            }
コード例 #17
0
        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;
            }
        }