private void Initialize() { _vsMonitorSelection = new AsyncLazy <IVsMonitorSelection>( async() => { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); // get the UI context cookie for the debugging mode var vsMonitorSelection = await _asyncServiceProvider.GetServiceAsync <IVsMonitorSelection, IVsMonitorSelection>(); Assumes.Present(vsMonitorSelection); // get the solution not building and not debugging cookie var guidCmdUI = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid; vsMonitorSelection.GetCmdUIContextCookie( ref guidCmdUI, out _solutionExistsAndFullyLoadedContextCookie); guidCmdUI = VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid; vsMonitorSelection.GetCmdUIContextCookie( ref guidCmdUI, out _solutionNotBuildingAndNotDebuggingContextCookie); guidCmdUI = VSConstants.UICONTEXT.SolutionExists_guid; vsMonitorSelection.GetCmdUIContextCookie( ref guidCmdUI, out _solutionExistsCookie); return(vsMonitorSelection); }, ThreadHelper.JoinableTaskFactory); _projectGuidToToolWindowId = new Dictionary <string, uint>(); }
OutputConsoleProvider( Microsoft.VisualStudio.Shell.IAsyncServiceProvider asyncServiceProvider, // ambigiuous reference IEnumerable <Lazy <IHostProvider, IHostMetadata> > hostProviders) { if (asyncServiceProvider == null) { throw new ArgumentNullException(nameof(asyncServiceProvider)); } if (hostProviders == null) { throw new ArgumentNullException(nameof(hostProviders)); } _hostProviders = hostProviders; _vsOutputWindow = new AsyncLazy <IVsOutputWindow>( async() => { return(await asyncServiceProvider.GetServiceAsync <SVsOutputWindow, IVsOutputWindow>()); }, NuGetUIThreadHelper.JoinableTaskFactory); _vsUIShell = new AsyncLazy <IVsUIShell>( async() => { return(await asyncServiceProvider.GetServiceAsync <SVsUIShell, IVsUIShell>()); }, NuGetUIThreadHelper.JoinableTaskFactory); _cachedOutputConsole = new Lazy <IConsole>( () => new OutputConsole(VsOutputWindow, VsUIShell)); }
private async Task SubscribeAsync(Microsoft.VisualStudio.Shell.IAsyncServiceProvider serviceProvider) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _serviceProvider = serviceProvider; var commandService = await serviceProvider.GetServiceAsync <IMenuCommandService, IMenuCommandService>(throwOnFailure : false); var menuCommandId = new CommandID(CommandSet, CommandId); var menuItem = new OleMenuCommand( OnRestorePackages, null, BeforeQueryStatusForPackageRestore, menuCommandId); commandService.AddCommand(menuItem); _vsMonitorSelection = await serviceProvider.GetServiceAsync <IVsMonitorSelection, IVsMonitorSelection>(); Assumes.Present(_vsMonitorSelection); // get the solution not building and not debugging cookie var guidCmdUI = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid; _vsMonitorSelection.GetCmdUIContextCookie( ref guidCmdUI, out _solutionExistsAndFullyLoadedContextCookie); guidCmdUI = VSConstants.UICONTEXT.SolutionExistsAndNotBuildingAndNotDebugging_guid; _vsMonitorSelection.GetCmdUIContextCookie( ref guidCmdUI, out _solutionNotBuildingAndNotDebuggingContextCookie); }
public static async Task InitializeAsync(Shell.IAsyncServiceProvider provider) { await Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); { s_ServerId = SERVER_PREFIX;// + System.Diagnostics.Process.GetCurrentProcess().Id.ToString(); s_PipePool = new PipePool(s_ServerId); s_PipePool.Start(); } { s_Service = await provider.GetServiceAsync(typeof(SVsShellDebugger)) as IVsDebugger; s_DTE = await provider.GetServiceAsync(typeof(SDTE)) as DTE; } if (s_Service != null) { s_Service.AdviseDebuggerEvents(Instance, out s_Cookie); s_Service.AdviseDebugEventCallback(Instance); } try { await Task.Run(() => InitAdresses()); } catch (Exception ex) { service.Output.WriteError(ex.ToString()); } }
public async static Task <OpenFileTracker> CreateAsync(VisualStudioWorkspaceImpl workspace, IAsyncServiceProvider asyncServiceProvider) { var runningDocumentTable = (IVsRunningDocumentTable)await asyncServiceProvider.GetServiceAsync(typeof(SVsRunningDocumentTable)).ConfigureAwait(true); var componentModel = (IComponentModel)await asyncServiceProvider.GetServiceAsync(typeof(SComponentModel)).ConfigureAwait(true); return(new OpenFileTracker(workspace, runningDocumentTable, componentModel)); }
public async Task <EnvDTE80.DTE2> GetDTEAsync() { var service = _serviceProvider.GetServiceAsync(typeof(DTE)); EnvDTE80.DTE2 applicationObject = await Task.Run(() => service) as EnvDTE80.DTE2; return(applicationObject); }
public VsProjectAdapterProvider( [Import(typeof(SAsyncServiceProvider))] IAsyncServiceProvider serviceProvider, IVsProjectThreadingService threadingService) : this( threadingService, new AsyncLazy <IDeferredProjectWorkspaceService>(() => serviceProvider.GetServiceAsync <IDeferredProjectWorkspaceService>(), threadingService.JoinableTaskFactory), new AsyncLazy <IVsSolution5>(() => serviceProvider.GetServiceAsync <SVsSolution, IVsSolution5>(), threadingService.JoinableTaskFactory)) { }
async Task Log(String message) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); if (outputPanel == null) { outputPanel = await asyncServiceProvider.GetServiceAsync(typeof(SVsGeneralOutputWindowPane)) as IVsOutputWindowPane; } outputPanel.OutputStringThreadSafe(message + Environment.NewLine); }
private async Task InitializeAsync() { await NuGetUIThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _vsSolution = await _asyncServiceProvider.GetServiceAsync <SVsSolution, IVsSolution>(); var dte = await _asyncServiceProvider.GetDTEAsync(); UserAgent.SetUserAgentString( new UserAgentStringBuilder(VSNuGetClientName).WithVisualStudioSKU(dte.GetFullVsVersionString())); HttpHandlerResourceV3.CredentialService = new Lazy <ICredentialService>(() => { return(NuGetUIThreadHelper.JoinableTaskFactory.Run(async() => { return await _credentialServiceProvider.GetCredentialServiceAsync(); })); }); TelemetryActivity.NuGetTelemetryService = new NuGetVSTelemetryService(); _vsMonitorSelection = await _asyncServiceProvider.GetServiceAsync <SVsShellMonitorSelection, IVsMonitorSelection>(); var solutionLoadedGuid = VSConstants.UICONTEXT.SolutionExistsAndFullyLoaded_guid; _vsMonitorSelection.GetCmdUIContextCookie(ref solutionLoadedGuid, out _solutionLoadedUICookie); uint cookie; var hr = _vsMonitorSelection.AdviseSelectionEvents(this, out cookie); ErrorHandler.ThrowOnFailure(hr); // Keep a reference to SolutionEvents so that it doesn't get GC'ed. Otherwise, we won't receive events. _solutionEvents = dte.Events.SolutionEvents; _solutionEvents.BeforeClosing += OnBeforeClosing; _solutionEvents.AfterClosing += OnAfterClosing; _solutionEvents.ProjectAdded += OnEnvDTEProjectAdded; _solutionEvents.ProjectRemoved += OnEnvDTEProjectRemoved; _solutionEvents.ProjectRenamed += OnEnvDTEProjectRenamed; var vSStd97CmdIDGUID = VSConstants.GUID_VSStandardCommandSet97.ToString("B"); var solutionSaveID = (int)VSConstants.VSStd97CmdID.SaveSolution; var solutionSaveAsID = (int)VSConstants.VSStd97CmdID.SaveSolutionAs; _solutionSaveEvent = dte.Events.CommandEvents[vSStd97CmdIDGUID, solutionSaveID]; _solutionSaveAsEvent = dte.Events.CommandEvents[vSStd97CmdIDGUID, solutionSaveAsID]; _solutionSaveEvent.BeforeExecute += SolutionSaveAs_BeforeExecute; _solutionSaveEvent.AfterExecute += SolutionSaveAs_AfterExecute; _solutionSaveAsEvent.BeforeExecute += SolutionSaveAs_BeforeExecute; _solutionSaveAsEvent.AfterExecute += SolutionSaveAs_AfterExecute; _projectSystemCache.CacheUpdated += NuGetCacheUpdate_After; }
/// <summary> /// Gets Guid of project /// </summary> /// <param name="project">Project to get guid of</param> /// <returns>Returns project guid</returns> public async Task <Guid> GetProjectGuidAsync(Project project) { Guid projectGuid = Guid.Empty; IVsHierarchy hierarchy; IVsSolution solution = await _serviceProvider.GetServiceAsync(typeof(SVsSolution)) as IVsSolution; solution.GetProjectOfUniqueName(project.FullName, out hierarchy); if (hierarchy != null) { solution.GetGuidOfProject(hierarchy, out projectGuid); } return(projectGuid); }
public SolutionRestoreWorker( IAsyncServiceProvider asyncServiceProvider, Lazy <IVsSolutionManager> solutionManager, Lazy <INuGetLockService> lockService, Lazy <Common.ILogger> logger, Lazy <INuGetErrorList> errorList, Lazy <IOutputConsoleProvider> outputConsoleProvider) { if (asyncServiceProvider == null) { throw new ArgumentNullException(nameof(asyncServiceProvider)); } if (solutionManager == null) { throw new ArgumentNullException(nameof(solutionManager)); } if (lockService == null) { throw new ArgumentNullException(nameof(lockService)); } if (logger == null) { throw new ArgumentNullException(nameof(logger)); } if (errorList == null) { throw new ArgumentNullException(nameof(errorList)); } if (outputConsoleProvider == null) { throw new ArgumentNullException(nameof(outputConsoleProvider)); } _asyncServiceProvider = asyncServiceProvider; _solutionManager = solutionManager; _lockService = lockService; _logger = logger; _errorList = errorList; _outputConsoleProvider = outputConsoleProvider; var joinableTaskContextNode = new JoinableTaskContextNode(ThreadHelper.JoinableTaskContext); _joinableCollection = joinableTaskContextNode.CreateCollection(); JoinableTaskFactory = joinableTaskContextNode.CreateFactory(_joinableCollection); _componentModel = new AsyncLazy <IComponentModel>(async() => { return(await asyncServiceProvider.GetServiceAsync <SComponentModel, IComponentModel>()); }, JoinableTaskFactory); _solutionLoadedEvent = new AsyncManualResetEvent(); _isCompleteEvent = new AsyncManualResetEvent(); Reset(); }
internal VSSolutionManager( IAsyncServiceProvider asyncServiceProvider, IProjectSystemCache projectSystemCache, NuGetProjectFactory projectSystemFactory, ICredentialServiceProvider credentialServiceProvider, IVsProjectAdapterProvider vsProjectAdapterProvider, ILogger logger, Lazy <ISettings> settings, INuGetFeatureFlagService featureFlagService, JoinableTaskContext joinableTaskContext) { Assumes.Present(asyncServiceProvider); Assumes.Present(projectSystemCache); Assumes.Present(projectSystemFactory); Assumes.Present(credentialServiceProvider); Assumes.Present(vsProjectAdapterProvider); Assumes.Present(logger); Assumes.Present(settings); Assumes.Present(featureFlagService); Assumes.Present(joinableTaskContext); _asyncServiceProvider = asyncServiceProvider; _projectSystemCache = projectSystemCache; _projectSystemFactory = projectSystemFactory; _credentialServiceProvider = credentialServiceProvider; _vsProjectAdapterProvider = vsProjectAdapterProvider; _logger = logger; _settings = settings; _featureFlagService = featureFlagService; _initLock = new NuGetLockService(joinableTaskContext); _dte = new(() => asyncServiceProvider.GetDTEAsync(), NuGetUIThreadHelper.JoinableTaskFactory); _asyncVSSolution = new(() => asyncServiceProvider.GetServiceAsync <SVsSolution, IVsSolution>(), NuGetUIThreadHelper.JoinableTaskFactory); }
private async ValueTask <RoslynPackage?> TryGetRoslynPackageAsync( CancellationToken cancellationToken ) { if (_roslynPackage is null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync( cancellationToken ); var shell = (IVsShell7?)await _serviceProvider .GetServiceAsync(typeof(SVsShell)) .ConfigureAwait(true); Assumes.Present(shell); await shell.LoadPackageAsync(typeof(RoslynPackage).GUID); if ( ErrorHandler.Succeeded( ((IVsShell)shell).IsPackageLoaded( typeof(RoslynPackage).GUID, out var package ) ) ) { _roslynPackage = (RoslynPackage)package; } } return(_roslynPackage); }
public Task GetItemsAsync(string searchString, IOmniBoxSearchSession searchSession) { return(this.joinableTaskContext.Factory.RunAsync(async delegate { try { searchSession.CancellationToken.ThrowIfCancellationRequested(); // Has STA requirement, explicit marshal to avoid potential deadlocks. await this.joinableTaskContext.Factory.SwitchToMainThreadAsync(searchSession.CancellationToken); searchSession.CancellationToken.ThrowIfCancellationRequested(); IVsTemplateProviderFactory templateProviderFactory = await asyncServiceProvider .GetServiceAsync(typeof(Microsoft.Internal.VisualStudio.Shell.Interop.SVsDialogService)) as IVsTemplateProviderFactory; var installedTemplateProvider = templateProviderFactory.GetInstalledTemplateProvider(); var searchResultsNode = installedTemplateProvider.Search(searchString); foreach (IVsSearchResultTemplate template in searchResultsNode.Extensions) { OmniBoxItem obItem = new NPDTemplateSearchResultShim(template, installedTemplateProvider); searchSession.AddItem(obItem); searchSession.CancellationToken.ThrowIfCancellationRequested(); } } catch (Exception ex) when(!(ex is OperationCanceledException)) { Debug.Fail("Exception during NPD search " + ex.Message); } }).Task); }
private string GetActiveFilePath(Microsoft.VisualStudio.Shell.IAsyncServiceProvider serviceProvider) { Task <object> t = serviceProvider.GetServiceAsync(typeof(EnvDTE.DTE)); t.Wait( ); EnvDTE80.DTE2 applicationObject = t.Result as EnvDTE80.DTE2; foreach (EnvDTE.SelectedItem selectedItem in applicationObject.SelectedItems) { if (selectedItem.ProjectItem == null) { return(null); } var projectItem = selectedItem.ProjectItem; var fullPathProperty = projectItem.Properties.Item("FullPath"); if (fullPathProperty == null) { return(null); } var fullPath = fullPathProperty.Value.ToString( ); return(fullPath); } return(null); }
/// <summary> /// Initialize the watcher. /// </summary> protected override async Task InitializeCoreAsync(CancellationToken cancellationToken) { _fileChangeService = (IVsFileChangeEx)(await _asyncServiceProvider.GetServiceAsync(typeof(SVsFileChangeEx)).ConfigureAwait(false)); // Explicitly get back to the thread pool for the rest of this method so we don't tie up the UI thread; await TaskScheduler.Default; await _projectTasksService.LoadedProjectAsync(() => { // The tree source to get changes to the tree so that we can identify when the assets file changes. var treeSource = _fileSystemTreeProvider.Tree.SyncLinkOptions(); // The property source used to get the value of the $ProjectAssetsFile property so that we can identify the location of the assets file. var sourceLinkOptions = new StandardRuleDataflowLinkOptions { RuleNames = Empty.OrdinalIgnoreCaseStringSet.Add(ConfigurationGeneral.SchemaName), PropagateCompletion = true }; var propertySource = _activeConfiguredProjectSubscriptionService.ProjectRuleSource.SourceBlock.SyncLinkOptions(sourceLinkOptions); var target = new ActionBlock <IProjectVersionedValue <Tuple <IProjectTreeSnapshot, IProjectSubscriptionUpdate> > >(DataFlow_ChangedAsync); // Join the two sources so that we get synchronized versions of the data. _treeWatcher = ProjectDataSources.SyncLinkTo(treeSource, propertySource, target); return(Task.CompletedTask); }).ConfigureAwait(false); }
public static async Task <IWpfTextViewHost> GetCurrentViewHostAsync(IAsyncServiceProvider serviceProvider) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var txtMgr = await serviceProvider.GetServiceAsync <SVsTextManager, IVsTextManager>(); int mustHaveFocus = 1; if (txtMgr == null) { return(null); } txtMgr.GetActiveView(mustHaveFocus, null, out IVsTextView vTextView); if (!(vTextView is IVsUserData userData)) { return(null); } Guid guidViewHost = DefGuidList.guidIWpfTextViewHost; userData.GetData(ref guidViewHost, out var holder); return(holder as IWpfTextViewHost); }
protected override async Task InitializeCoreAsync(CancellationToken cancellationToken) { AggregateSnapshotProvider.SnapshotChanged += OnSnapshotChanged; _imageService = (IVsImageService2)await ServiceProvider.GetServiceAsync(typeof(SVsImageService)) .ConfigureAwait(false); // Want to get off UI thread if switch to it }
public static async Task <RestoreOperationProgressUI> StartAsync( IAsyncServiceProvider asyncServiceProvider, JoinableTaskFactory jtf, CancellationToken token) { await jtf.SwitchToMainThreadAsync(); var statusBar = await asyncServiceProvider.GetServiceAsync <SVsStatusbar, IVsStatusbar>(); // Make sure the status bar is not frozen int frozen; statusBar.IsFrozen(out frozen); if (frozen != 0) { statusBar.FreezeOutput(0); } statusBar.Animation(1, ref Icon); RestoreOperationProgressUI progress = new StatusBarProgress(statusBar, jtf); await progress.ReportProgressAsync(Resources.RestoringPackages); return(progress); }
public VisualStudioActiveDocumentTracker( IThreadingContext threadingContext, [Import(typeof(SVsServiceProvider))] IAsyncServiceProvider asyncServiceProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) : base(threadingContext, assertIsForeground: false) { _editorAdaptersFactoryService = editorAdaptersFactoryService; _asyncTasks = new JoinableTaskCollection(threadingContext.JoinableTaskContext); _asyncTasks.Add(ThreadingContext.JoinableTaskFactory.RunAsync(async() => { await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(); var monitorSelectionService = (IVsMonitorSelection)await asyncServiceProvider.GetServiceAsync(typeof(SVsShellMonitorSelection)).ConfigureAwait(false); if (ErrorHandler.Succeeded(monitorSelectionService.GetCurrentElementValue((uint)VSConstants.VSSELELEMID.SEID_DocumentFrame, out var value))) { if (value is IVsWindowFrame windowFrame) { TrackNewActiveWindowFrame(windowFrame); } } monitorSelectionService.AdviseSelectionEvents(this, out var _); })); }
public VisualStudioActiveDocumentTracker( IThreadingContext threadingContext, [Import(typeof(SVsServiceProvider))] IAsyncServiceProvider asyncServiceProvider, IVsEditorAdaptersFactoryService editorAdaptersFactoryService) : base(threadingContext, assertIsForeground: false) { _editorAdaptersFactoryService = editorAdaptersFactoryService; ThreadingContext.RunWithShutdownBlockAsync(async cancellationToken => { await ThreadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); var monitorSelectionService = (IVsMonitorSelection)await asyncServiceProvider.GetServiceAsync(typeof(SVsShellMonitorSelection)).ConfigureAwait(true); Assumes.Present(monitorSelectionService); // No need to track windows if we are shutting down cancellationToken.ThrowIfCancellationRequested(); if (ErrorHandler.Succeeded(monitorSelectionService.GetCurrentElementValue((uint)VSConstants.VSSELELEMID.SEID_DocumentFrame, out var value))) { if (value is IVsWindowFrame windowFrame) { TrackNewActiveWindowFrame(windowFrame); } } monitorSelectionService.AdviseSelectionEvents(this, out var _); }); }
/// <summary> /// Returns an IVsTextView for the given file path, if the given file is open in Visual Studio. /// </summary> /// <param name="serviceProvider">The package Service Provider.</param> /// <param name="filePath">Full Path of the file you are looking for.</param> /// <returns> /// The IVsTextView for this file, if it is open, null otherwise. /// </returns> internal static async Task <IWpfTextView> GetWpfTextViewByFilePathAsync(this Shell.IAsyncServiceProvider serviceProvider, string filePath) { if (filePath.IsNullOrWhiteSpace() || serviceProvider == null) { return(null); } if (!Shell.ThreadHelper.CheckAccess()) { await Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); } DTE2 dte2 = await serviceProvider.GetServiceAsync <Shell.Interop.SDTE, DTE2>(); var oleServiceProvider = dte2 as Microsoft.VisualStudio.OLE.Interop.IServiceProvider; if (dte2 == null || oleServiceProvider == null) { return(null); } Shell.ServiceProvider shellServiceProvider = new Shell.ServiceProvider(oleServiceProvider); if (Shell.VsShellUtilities.IsDocumentOpen(shellServiceProvider, filePath, Guid.Empty, out var uiHierarchy, out var itemID, out var windowFrame)) { IVsTextView textView = Shell.VsShellUtilities.GetTextView(windowFrame); // Get the IVsTextView from the windowFrame return(await serviceProvider.GetWpfTextViewFromTextViewAsync(textView)); } return(null); }
public async Task <NuGet.Configuration.ICredentialService> GetCredentialServiceAsync() { // Initialize the credential providers. var credentialProviders = new List <ICredentialProvider>(); var webProxy = await _asyncServiceProvider.GetServiceAsync <SVsWebProxy, IVsWebProxy>(); TryAddCredentialProviders( credentialProviders, Strings.CredentialProviderFailed_VisualStudioAccountProvider, () => { var importer = new VsCredentialProviderImporter( (exception, failureMessage) => LogCredentialProviderError(exception, failureMessage)); return(importer.GetProviders()); }); TryAddCredentialProviders( credentialProviders, Strings.CredentialProviderFailed_VisualStudioCredentialProvider, () => { Debug.Assert(webProxy != null); return(new ICredentialProvider[] { new VisualStudioCredentialProvider(webProxy) }); }); await TryAddCredentialProvidersAsync( credentialProviders, Strings.CredentialProviderFailed_PluginCredentialProvider, async() => await(new SecurePluginCredentialProviderBuilder(PluginManager.Instance, canShowDialog: true, logger: NullLogger.Instance).BuildAllAsync()) ); if (PreviewFeatureSettings.DefaultCredentialsAfterCredentialProviders) { TryAddCredentialProviders( credentialProviders, Strings.CredentialProviderFailed_DefaultCredentialsCredentialProvider, () => { return(new ICredentialProvider[] { new DefaultNetworkCredentialsCredentialProvider() }); }); } // can only interact when VS is not in server mode. bool nonInteractive = await VisualStudioContextHelper.IsInServerModeAsync(CancellationToken.None); // Initialize the credential service. var credentialService = new CredentialService( new AsyncLazy <IEnumerable <ICredentialProvider> >(() => System.Threading.Tasks.Task.FromResult((IEnumerable <ICredentialProvider>)credentialProviders)), nonInteractive: nonInteractive, handlesDefaultCredentials: PreviewFeatureSettings.DefaultCredentialsAfterCredentialProviders); return(credentialService); }
public async Task InitializeAsync(CancellationToken cancellationToken) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); output = await serviceProvider.GetServiceAsync(typeof(SVsOutputWindow)) as IVsOutputWindow; Assumes.Present(output); }
public static IVsTextView GetTextView(this IAsyncServiceProvider serviceProvider) { var service = serviceProvider.GetServiceAsync(typeof(SVsTextManager)).Result; var textManager = service as IVsTextManager2; textManager.GetActiveView2(1, null, (uint)_VIEWFRAMETYPE.vftCodeWindow, out IVsTextView view); return(view); }
public async Task InitAsync(IAsyncServiceProvider asyncServiceProvider) { _vsprojectSelector = (IVsRegisterProjectSelector)await asyncServiceProvider.GetServiceAsync(typeof(SVsRegisterProjectTypes)); Guid selectorGuid = GetType().GUID; _vsprojectSelector.RegisterProjectSelector(ref selectorGuid, this, out _cookie); return; }
public static async Task <GraphIconCache> CreateAsync(IAsyncServiceProvider serviceProvider) { #pragma warning disable RS0030 // Do not used banned APIs var imageService = (IVsImageService2)await serviceProvider.GetServiceAsync(typeof(SVsImageService)); #pragma warning restore RS0030 // Do not used banned APIs return(new GraphIconCache(imageService)); }
public static async Task InitializeAsync(Shell.IAsyncServiceProvider provider, string name) { await Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); _output = await provider.GetServiceAsync(typeof(SVsOutputWindow)) as IVsOutputWindow; Assumes.Present(_output); _name = name; }
public async Task InitializeAsync(IAsyncServiceProvider asyncServiceProvider) { Assumes.Null(_solution); Assumes.True(_context.IsOnMainThread, "Must be on UI thread"); _solution = await asyncServiceProvider.GetServiceAsync <IVsSolution, IVsSolution>(); Verify.HResult(_solution.AdviseSolutionEvents(this, out _cookie)); }
public VsHierarchyItemManagerProvider([Import(typeof(SAsyncServiceProvider))] IAsyncServiceProvider services, JoinableTaskContext context) { hierarchyManager = new JoinableLazy <IVsHierarchyItemManager>(async() => { var componentModel = await services.GetServiceAsync(typeof(SComponentModel)) as IComponentModel; return(componentModel?.GetService <IVsHierarchyItemManager>()); }, context?.Factory, executeOnMainThread: true); }