protected override void Dispose(bool disposing)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (this.debugCookie != 0)
            {
                this.debuggerForCookie.UnadviseDebuggerEvents(this.debugCookie);
                this.debuggerForCookie = null;
                this.debugCookie       = 0;
            }

            if (this.frameCookie != 0)
            {
                this.frameForCookie.Unadvise(this.frameCookie);
                this.frameForCookie = null;
                this.frameCookie    = 0;
            }

            if (this.debugTextBuffer != null)
            {
                this.debugTextBuffer.Changed -= this.OnTextBufferChanged;
            }

            this.cancellationTokenSource.Cancel();
            this.cancellationTokenSource.Dispose();
            this.dataBindingOutputLevelKey.Dispose();
            this.viewModel.Dispose();

            base.Dispose(disposing);
        }
示例#2
0
        void IVSEditorControlInit.InitializedForm(Microsoft.VisualStudio.Shell.Interop.IVsUIHierarchy hier, uint id, IVsWindowFrame frame, IAnkhEditorPane pane)
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            _frame = frame;
            _pane  = pane;

            if (_targets != null && pane != null)
            {
                foreach (IOleCommandTarget t in _targets)
                {
                    _pane.AddCommandTarget(t);
                }
            }

            IVsWindowFrame2 frame2 = _frame as IVsWindowFrame2;

            if (frame2 != null)
            {
                if (frame2.Advise(this, out _frameNotifyCookie) != 0)
                {
                    _frameNotifyCookie = 0;
                }
            }

            OnFrameLoaded(EventArgs.Empty);
        }
示例#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);
        }
示例#4
0
        public IVsWindowFrame FindSolutionExplorerFrame(IVsUIShell uiShell)
        {
            if (SolutionExplorer == null)
            {
                //IVsUIShell shell = GetService<IVsUIShell>(typeof(SVsUIShell));
                //IVsUIShell uiShell = (IVsUIShell)cmp.GetService(typeof(SVsUIShell));

                Debug.Assert(uiShell != null); // Must be true

                if (uiShell != null)
                {
                    IVsWindowFrame solutionExplorer;
                    Guid           solutionExplorerGuid = new Guid(ToolWindowGuids80.SolutionExplorer);

                    Marshal.ThrowExceptionForHR(uiShell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref solutionExplorerGuid, out solutionExplorer));

                    if (solutionExplorer != null)
                    {
                        SolutionExplorer = solutionExplorer;
                        IVsWindowFrame2 solutionExplorer2 = solutionExplorer as IVsWindowFrame2;

                        if (solutionExplorer2 != null)
                        {
                            uint cookie;
                            Marshal.ThrowExceptionForHR(solutionExplorer2.Advise(this, out cookie));
                            Cookie            = cookie;
                            SolutionExplorer2 = solutionExplorer2;
                        }
                    }
                }
            }
            return(SolutionExplorer);
        }
示例#5
0
            public WindowFrameEvents(IVsWindowFrame2 frame)
            {
                ThreadHelper.ThrowIfNotOnUIThread();

                this.frame = frame;
                ErrorHandler.ThrowOnFailure(frame.Advise(this, out this.cookie));
            }
示例#6
0
        public DiffMergeInstance(IAnkhServiceProvider context, IVsWindowFrame frame)
            : base(context)
        {
            _frame  = frame;
            _frame2 = frame as IVsWindowFrame2;

            if (_frame2 != null && VSErr.Succeeded(_frame2.Advise(this, out _frameCookie)))
            {
                _frameHooked = true;
            }
        }
        /// <summary>
        /// Called after this.Frame gets set
        /// </summary>
        public override void OnToolWindowCreated()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            if (this.Frame is IVsWindowFrame2 frame)
            {
                this.frameForCookie = frame;
                this.frameForCookie.Advise(this, out this.frameCookie);
            }

            base.OnToolWindowCreated();
        }
        private ToolWindowPane createBuildDetailsWindow()
        {
            IVsWindowFrame windowFrame;
            ToolWindowPane window = createDetailsWindow(typeof(BuildDetailsToolWindow), out windowFrame);

            BuildDetailsWindow.Instance.WindowFrame = window;
            IVsWindowFrame2 wf2 = (IVsWindowFrame2)windowFrame;
            uint            cookie;

            wf2.Advise(BuildDetailsWindow.Instance, out cookie);
            return(window);
        }
        public VsWindowFrameNotifyHandler(IVsWindowFrame2 frame)
        {
            _frame     = frame;
            _isVisible = true;

            var winFrame = frame as IVsWindowFrame;

            if (winFrame != null)
            {
                object currentFrameMode;
                winFrame.GetProperty((int)__VSFPROPID.VSFPROPID_FrameMode, out currentFrameMode);
                _isDocked = (VSFRAMEMODE)currentFrameMode == VSFRAMEMODE.VSFM_Dock;
            }
        }
        public void Dispose()
        {
            if (_hookImageList && _solutionExplorer2 != null)
            {
                try
                {
                    _solutionExplorer2.Unadvise(_cookie);
                }
                catch { /* Probably unclean shutdown */ }
                _solutionExplorer2 = null;
            }

            _solutionExplorer = null;
            _solutionExplorer2 = null;
            _tree = null;
        }
        /// <summary>
        /// Shows the tool window when the menu item is clicked.
        /// </summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event args.</param>
        private void ShowToolWindow(object sender, EventArgs e)
        {
            // Get the instance number 0 of this tool window. This window is single instance so this instance
            // is actually the only one.
            // The last flag is set to true so that if the tool window does not exists it will be created.
            ToolWindowPane window = this.package.FindToolWindow(typeof(RapidSearchWindow), 0, true);

            if ((null == window) || (null == window.Frame))
            {
                throw new NotSupportedException("Cannot create tool window");
            }

            IVsWindowFrame2 windowFrame = (IVsWindowFrame2)window.Frame;

            Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.ActivateOwnerDockedWindow());
        }
示例#12
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;
        }
示例#13
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);
            }
        }
        public void Dispose()
        {
            if (_solutionExplorer2 != null)
            {
                try
                {
                    _solutionExplorer2.Unadvise(_cookie);
                }
                catch { /* Probably unclean shutdown */ }
                _solutionExplorer2 = null;
            }

            _solutionExplorer = null;
            _solutionExplorer2 = null;
            _tree = null;
        }
示例#15
0
 private InteractiveWindowEvents(IVsWindowFrame2 frame, IVsInteractiveWindow window) {
     _frame = frame;
     _window = window;
     ErrorHandler.ThrowOnFailure(frame.Advise(this, out _cookie));
 }
 public VsWindowFrameNotifyHandler(IVsWindowFrame2 frame)
 {
     _frame     = frame;
     _isVisible = true;
 }
 public VsWindowFrameNotifyHandler(IVsWindowFrame2 frame) {
   _frame = frame;
   _isVisible = true;
 }
示例#18
0
 private InteractiveWindowEvents(IVsWindowFrame2 frame, IVsInteractiveWindow window)
 {
     _frame  = frame;
     _window = window;
     ErrorHandler.ThrowOnFailure(frame.Advise(this, out _cookie));
 }
示例#19
0
 public WindowFrameEvents(IVsWindowFrame2 frame, EmbeddedTerminal terminal)
 {
     this.frame    = frame;
     this.terminal = terminal;
 }