/// <summary> /// Search for packages using the searchText. /// </summary> /// <param name="windowFrame">A window frame that hosts the PackageManagerControl.</param> /// <param name="searchText">Search text.</param> private void Search(IVsWindowFrame windowFrame, string searchText) { ThreadHelper.ThrowIfNotOnUIThread(); if (string.IsNullOrWhiteSpace(searchText)) { return; } var packageManagerControl = VsUtility.GetPackageManagerControl(windowFrame); if (packageManagerControl != null) { packageManagerControl.Search(searchText); } }
private IVsWindowFrame FindExistingSolutionWindowFrame() { IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); foreach (var windowFrame in VsUtility.GetDocumentWindows(uiShell)) { object property; int hr = windowFrame.GetProperty( (int)__VSFPROPID.VSFPROPID_DocData, out property); var packageManagerControl = VsUtility.GetPackageManagerControl(windowFrame); if (hr == VSConstants.S_OK && property is IVsSolution && packageManagerControl != null) { return windowFrame; } } return null; }
private async Task <IVsWindowFrame> FindExistingSolutionWindowFrameAsync() { var uiShell = await GetServiceAsync(typeof(SVsUIShell)) as IVsUIShell; foreach (var windowFrame in VsUtility.GetDocumentWindows(uiShell)) { object property; int hr = windowFrame.GetProperty( (int)__VSFPROPID.VSFPROPID_DocData, out property); var packageManagerControl = VsUtility.GetPackageManagerControl(windowFrame); if (hr == VSConstants.S_OK && property is IVsSolution && packageManagerControl != null) { return(windowFrame); } } return(null); }