private bool IsViewOnScreen(ITextView view) { Contract.Requires <ArgumentNullException>(view != null, "view"); IVsTextView viewAdapter = VsEditorAdaptersFactoryService.GetViewAdapter(view); IServiceProvider sp = viewAdapter as IServiceProvider; if (sp == null) { return(false); } IVsWindowFrame frame = sp.GetService(typeof(SVsWindowFrame)) as IVsWindowFrame; if (frame == null) { return(false); } int onScreen = 0; if (ErrorHandler.Succeeded(ErrorHandler.CallWithCOMConvention(() => frame.IsOnScreen(out onScreen)))) { return(onScreen != 0); } return(false); }
public bool IsVisible() { int isOnScreen; int result = _windowFrame.IsOnScreen(out isOnScreen); return(result == VSConstants.S_OK && isOnScreen == 1 && _windowFrame.IsVisible() == VSConstants.S_OK); }
public void bringToFront() { IVsWindowFrame frame = Frame as IVsWindowFrame; int onScreen = 0; if (frame != null) { frame.IsOnScreen(out onScreen); } if (frame != null && onScreen == 0) { frame.ShowNoActivate(); } }
protected void UpdatePropertyView(WorkitemDescriptor selectedItem) { //Try to get PropertiesFrame if (propertiesFrame == null) { var shell = GetService <IVsUIShell>(typeof(SVsUIShell)); if (shell != null) { var guidPropertyBrowser = new Guid(ToolWindowGuids.PropertyBrowser); shell.FindToolWindow((uint)__VSFINDTOOLWIN.FTW_fForceCreate, ref guidPropertyBrowser, out propertiesFrame); } } if (propertiesFrame == null) { return; } int visible; propertiesFrame.IsOnScreen(out visible); if (visible == 1) { propertiesFrame.ShowNoActivate(); // Show() in original } var selectionContainer = new SelectionContainer(); if (selectedItem != null) { selectionContainer.SelectedObjects = new object[] { selectedItem }; CurrentWorkitemId = selectedItem.Entity.Id; } else { CurrentWorkitemId = null; } var track = GetService <ITrackSelection>(typeof(STrackSelection)); if (track != null) { track.OnSelectChange(selectionContainer); } }
// -------------------------------------------------------------------------------------------- /// <summary> /// Returns true if the window frame is on the screen. /// </summary> /// <param name="pfOnScreen">true if the window frame is visible on the screen.</param> /// <returns> /// If the method succeeds, it returns S_OK. If it fails, it returns an error code. /// </returns> /// <remarks> /// IVsWindowFrame.IsOnScreen checks to see if a window hosted by the Visual Studio IDE has /// been autohidden, or if the window is part of a tabbed display and currently obscured by /// another tab. IsOnScreen also checks to see whether the instance of the Visual Studio IDE /// is minimized or obscured. IsOnScreen differs from the behavior of IsWindowVisible a /// method that may return true even if the window is completely obscured or minimized. /// IsOnScreen also differs from IsVisible which does not check to see if the Visual Studio /// IDE has autohidden the window, or if the window is tabbed and currently obscured by /// another window. /// </remarks> // -------------------------------------------------------------------------------------------- int IVsWindowFrame.IsOnScreen(out int pfOnScreen) { return(_Frame.IsOnScreen(out pfOnScreen)); }