Exemplo n.º 1
0
 int IVsWindowFrameNotify2.OnClose(ref uint pgrfSaveOptions)
 {
     _frame.Unadvise(_cookie);
     _cookie = 0;
     Closed?.Invoke(_window, EventArgs.Empty);
     return(VSConstants.S_OK);
 }
        int IVsWindowFrameNotify.OnShow(int fShow)
        {
            var show = (__FRAMESHOW)fShow;

            switch (show)
            {
            case __FRAMESHOW.FRAMESHOW_Hidden:
                _isVisible = false;
                break;

            case __FRAMESHOW.FRAMESHOW_WinShown:
                _isVisible = true;
                break;

            case __FRAMESHOW.FRAMESHOW_WinClosed:
                _isVisible = false;
                var hr = _frame.Unadvise(_notifyCookie);
                if (ErrorHandler.Failed(hr))
                {
                    Logger.LogWarn("IVsWindowFrame2.Unadvise() failed: hr={0}", hr);
                }
                break;

            case __FRAMESHOW.FRAMESHOW_TabActivated:
            case __FRAMESHOW.FRAMESHOW_TabDeactivated:
            case __FRAMESHOW.FRAMESHOW_WinRestored:
            case __FRAMESHOW.FRAMESHOW_WinMinimized:
            case __FRAMESHOW.FRAMESHOW_WinMaximized:
            case __FRAMESHOW.FRAMESHOW_DestroyMultInst:
            case __FRAMESHOW.FRAMESHOW_AutoHideSlideBegin:
            default:
                break;
            }
            return(VSConstants.S_OK);
        }
Exemplo n.º 3
0
        int IVsWindowFrameNotify2.OnClose(ref uint pgrfSaveOptions)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (_frameNotifyCookie != 0)
            {
                try
                {
                    IVsWindowFrame2 frame2 = _frame as IVsWindowFrame2;

                    if (frame2 != null)
                    {
                        frame2.Unadvise(_frameNotifyCookie);
                    }
                }
                finally
                {
                    _frameNotifyCookie = 0;
                }
            }

            OnFrameClose(EventArgs.Empty);

            return(0);
        }
Exemplo n.º 4
0
        public void Dispose()
        {
            if (_hookImageList && _solutionExplorer2 != null)
            {
                try
                {
                    _solutionExplorer2.Unadvise(_cookie);
                }
                catch { /* Probably unclean shutdown */ }
                _solutionExplorer2 = null;
            }

            _solutionExplorer = null;
            _solutionExplorer2 = null;
            _tree = null;
        }
Exemplo n.º 5
0
        public void Dispose()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (_hookImageList && _solutionExplorer2 != null)
            {
                try
                {
                    _solutionExplorer2.Unadvise(_cookie);
                }
                catch { /* Probably unclean shutdown */ }
                _solutionExplorer2 = null;
            }

            _solutionExplorer  = null;
            _solutionExplorer2 = null;
            _tree = null;
        }
Exemplo n.º 6
0
        protected override void Dispose(bool disposing)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            try
            {
                if (disposing)
                {
                    if (_mergeHooked)
                    {
                        _mergeHooked = false;

                        UnregisterHandler unregister = _unregister;

                        IAnkhCommandService cs = GetService <IAnkhCommandService>();
                        if (cs != null)
                        {
                            cs.PostIdleAction(delegate
                            {
                                unregister(_mergeCookie);
                            });
                        }
                    }

                    if (_frameHooked)
                    {
                        _frameHooked = false;
                        _frame2.Unadvise(_frameCookie);
                    }
                }

                // Unbreak possible circular dependency
                _frame      = null;
                _frame2     = null;
                _unregister = null;
            }
            finally
            {
                base.Dispose(disposing);
            }
        }