/// <summary> /// This function is called when the user clicks the menu item that shows the /// tool window. See the Initialize method to see how the menu item is associated to /// this function using the OleMenuCommandService service and the MenuCommand class. /// </summary> private async void ShowToolWindow(object sender, EventArgs e) { await JoinableTaskFactory.SwitchToMainThreadAsync(DisposalToken); // 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 = await this.FindToolWindowAsync(typeof(MyToolWindow), 0, true, new CancellationToken(true)); if (window?.Frame == null) { throw new NotSupportedException(Resources.CanNotCreateWindow); } IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; if (windowFrame.IsVisible() == VSConstants.S_OK) { ErrorHandler.ThrowOnFailure(windowFrame.Hide()); } else { ErrorHandler.ThrowOnFailure(windowFrame.Show()); } }
void Display(bool show, bool force) { ToolWindowPane window = this.FindToolWindow(typeof(JStockWindow), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException(Resources.CanNotCreateWindow); } IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; if (force) { if (show) { windowFrame.Show(); } else { windowFrame.Hide(); } } else { if (windowFrame.IsVisible() == VSConstants.S_OK) { windowFrame.Hide(); } else { windowFrame.Show(); } } }
private void ShowHideWindowMenuItemCallback(object sender, EventArgs e) { ToolWindowPane window = this.FindToolWindow(typeof(JStockWindow), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException(Resources.CanNotCreateWindow); } IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; if (windowFrame.IsVisible() == VSConstants.S_OK) { if (isFirst) { StockService.Start(); isFirst = false; } else { Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Hide()); StockService.Stop(); } } else { Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); StockService.ReStart(); } }
private void callMethod(SchemaInfo schemaInfo, List <ClassInfo> depandancyClasses, List <InputValue> inputValues) { logger.Info("callMethod called"); schemaInfo.DepandancyClasses = depandancyClasses; schemaInfo.InputValues = inputValues.ToArray(); schemaInfoCommon.SetFileData(Json.Encode(schemaInfoCommon.SchemaInfo)); ThreadHelper.ThrowIfNotOnUIThread("callMethod"); logger.Info("fileCopyAndDebug called"); if (windowFrame != null && windowFrame.IsVisible() == 0) { interfaceMapperWithClassControl.UseDefault = false; ErrorHandler.ThrowOnFailure(windowFrame.Hide()); } inputWindowShow(schemaInfo, () => { if (windowInputFrame != null && windowInputFrame.IsVisible() == 0) { //interfaceMapperWithClassControl.UseDefault = false; ErrorHandler.ThrowOnFailure(windowInputFrame.Hide()); } fileCopyAndDebug(schemaInfo); }); }
public void showIfWindowNotCreated() { IVsWindowFrame frame = Frame as IVsWindowFrame; if (frame != null && frame.IsVisible() != VSConstants.S_OK) { frame.Show(); } }
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 showIfWindowNotCreated() { ThreadHelper.ThrowIfNotOnUIThread(); IVsWindowFrame frame = Frame as IVsWindowFrame; if (frame != null && frame.IsVisible() != VSConstants.S_OK) { frame.Show(); } }
internal bool IsGuidanceNavigatorToolWindowVisible() { IVsWindowFrame windowFrame = GetGuidanceNavigatorWindowFrame(); // yes, IsVisible will return 0 when the window is visible and 1 when it's not... if (windowFrame.IsVisible() == 0) { return(true); } else { return(false); } }
bool DetectClosedWindow() { if (_disposed) { return(true); } if (VSConstants.S_FALSE == _frame.IsVisible()) { _frame.CloseFrame((uint)__FRAMECLOSE.FRAMECLOSE_NoSave); Dispose(); } return(false); }
private bool IsConEmuToolWindowVisible(IVsWindowFrame windowFrame) { ThreadHelper.ThrowIfNotOnUIThread(); if (windowFrame != null && VSConstants.S_OK != windowFrame.IsVisible()) { return(false); } if (Instance.ConEmu == null) { return(false); } return(Instance.ConEmu.IsConsoleEmulatorOpen); }
public int OnSelectionChanged(IVsHierarchy pHierOld, uint itemidOld, IVsMultiItemSelect pMISOld, ISelectionContainer pSCOld, IVsHierarchy pHierNew, uint itemidNew, IVsMultiItemSelect pMISNew, ISelectionContainer pSCNew) { // The selected item can be a Solution, Project, meta ProjectItem or file ProjectItem // Don't update the tool window if the selection has not changed if (itemidOld == itemidNew) { return(VSConstants.E_NOTIMPL); } // Don't update the tool window if it doesn't exist if (toolWindow == null) { return(VSConstants.E_NOTIMPL); } // Don't update the tool window if it isn't visible IVsWindowFrame windowFrame = (IVsWindowFrame)toolWindow.Frame; if (windowFrame.IsVisible() == VSConstants.S_FALSE) { return(VSConstants.E_NOTIMPL); } Debug.WriteLine(itemidOld + "->" + itemidNew); EnvDTE.SelectedItem si = dte.SelectedItems.Item(1); EnvDTE.ProjectItem item = si.ProjectItem; // Solutions and Projects don't have ProjectItems if (item != null && item.FileCount != 0) { string filePath = item.FileNames[0]; // Only update for project items that exist (Not all of them do). if (File.Exists(filePath)) { UpdateToolWindow(filePath); return(VSConstants.E_NOTIMPL); } } ClearToolWindow(); return(VSConstants.E_NOTIMPL); }
/// <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(NuGetCommandLine), 0, true); if ((null == window) || (null == window.Frame)) { throw new NotSupportedException("Cannot create tool window"); } IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; if (windowFrame.IsVisible() == Microsoft.VisualStudio.VSConstants.S_FALSE) { Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); } }
/// <summary> /// This function is called when the user clicks the menu item that shows the /// tool window. See the Initialize method to see how the menu item is associated to /// this function using the OleMenuCommandService service and the MenuCommand class. /// </summary> 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.FindToolWindow(typeof(MyToolWindow), 0, true); if (window?.Frame == null) { throw new NotSupportedException(Resources.CanNotCreateWindow); } IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; if (windowFrame.IsVisible() == VSConstants.S_OK) { ErrorHandler.ThrowOnFailure(windowFrame.Hide()); } else { ErrorHandler.ThrowOnFailure(windowFrame.Show()); } }
private static bool IsClosedWindow(IVsWindowFrame windowFrame) { return(windowFrame.IsVisible() == VSConstants.S_FALSE); }
// -------------------------------------------------------------------------------------------- /// <summary> /// Determines whether or not the window is visible. /// </summary> /// <returns> /// Returns S_OK if the window is visible, otherwise returns S_FALSE. /// </returns> // -------------------------------------------------------------------------------------------- int IVsWindowFrame.IsVisible() { return(_Frame.IsVisible()); }