int IVsSolutionEvents.OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded) { IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnAfterOpenProject(pHierarchy, fAdded)); }
//--- //TODO: move to framework private void AdviseSolutionEvents(IVsSolutionEvents vsSolutionEvents) { uint solutionEventsCookie; var vsSolution = GetGlobalService <SVsSolution, IVsSolution>(); vsSolution.AdviseSolutionEvents(vsSolutionEvents, out solutionEventsCookie); }
int IVsSolutionEvents.OnBeforeCloseProject(IVsHierarchy pHierarchy, int fRemoved) { IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnBeforeCloseProject(pHierarchy, fRemoved)); }
public int AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { pdwCookie = 2; Debugger.Break(); return(0); }
int IVsSolutionEvents.OnBeforeCloseSolution(object pUnkReserved) { IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnBeforeCloseSolution(pUnkReserved)); }
int IVsSolutionEvents.OnQueryCloseSolution(object pUnkReserved, ref int pfCancel) { IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnQueryCloseSolution(pUnkReserved, ref pfCancel)); }
int IVsSolutionEvents.OnQueryCloseProject(IVsHierarchy pHierarchy, int fRemoving, ref int pfCancel) { IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnQueryCloseProject(pHierarchy, fRemoving, ref pfCancel)); }
protected override void Dispose(bool disposing) { UnadviseSolutionEvents(); Cache.Instance.Dispose(); _buildEvents = null; _documentEvents = null; _solutionEvents = null; base.Dispose(disposing); }
protected override void Dispose(bool disposing) { UnadviseSolutionEvents(); Cache.Instance.Dispose(); _buildEvents = null; _documentEvents = null; _solutionEvents = null; base.Dispose(disposing); }
int IVsSolutionEvents.OnQueryUnloadProject(IVsHierarchy pRealHierarchy, ref int pfCancel) { guidanceNavigatorManager.OnSolutionExplorerChanged(); IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnQueryUnloadProject(pRealHierarchy, ref pfCancel)); }
int IVsSolutionEvents.OnBeforeUnloadProject(IVsHierarchy pRealHierarchy, IVsHierarchy pStubHierarchy) { guidanceNavigatorManager.OnSolutionExplorerChanged(); IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnBeforeUnloadProject(pRealHierarchy, pStubHierarchy)); }
int IVsSolutionEvents.OnAfterOpenSolution(object pUnkReserved, int fNewSolution) { if (fNewSolution == 0) { isOpeningSolution = true; } IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnAfterOpenSolution(pUnkReserved, fNewSolution)); }
public virtual void before_each() { autoSubstitute = new AutoSubstitute(); someSolution = autoSubstitute.Resolve <IVsSolution>(); uint unregisterToken = VSConstants.VSCOOKIE_NIL; uint dummyToken = 12345; someSolution.AdviseSolutionEvents(Arg.Any <IVsSolutionEvents>(), out unregisterToken) .Returns(callInfo => { solutionEventSink = callInfo.Arg <IVsSolutionEvents>(); callInfo[1] = dummyToken; return(VSConstants.S_OK); }); var solutionProvider = autoSubstitute.Resolve <ISolutionProvider>(); solutionProvider.Provide().Returns(someSolution); notifier = autoSubstitute.Resolve <SolutionNotifier>(); var testScheduler = new TestScheduler(); solutionOpenedObserver = testScheduler.CreateObserver <SolutionInfo>(); solutionClosingObserver = testScheduler.CreateObserver <Unit>(); projectAddedObserver = testScheduler.CreateObserver <ProjectInfo>(); projectRemovingObserver = testScheduler.CreateObserver <ProjectInfo>(); disposables = new CompositeDisposable(); notifier.SolutionOpenedStream.Subscribe(solutionOpenedObserver).DisposeWith(disposables); notifier.SolutionClosingStream.Subscribe(solutionClosingObserver).DisposeWith(disposables); notifier.ProjectAddedStream.Subscribe(projectAddedObserver).DisposeWith(disposables); notifier.ProjectRemovingtream.Subscribe(projectRemovingObserver).DisposeWith(disposables); someHierarchy = autoSubstitute.Resolve <IVsHierarchy>(); }
int IVsSolutionEvents.OnAfterOpenSolution(object pUnkReserved, int fNewSolution) { if (fNewSolution == 0) { isOpeningSolution = true; } //if (guidanceNavigatorManager == null) //{ // guidanceNavigatorManager = new GuidanceNavigatorManager(this as System.IServiceProvider); //} //IRecipeManagerService rms = (IRecipeManagerService)GetService(typeof(IRecipeManagerService)); //rms.EnabledPackage += new PackageEventHandler(OnEnabledPackage); IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); int result = hostService.OnAfterOpenSolution(pUnkReserved, fNewSolution); //isOpeningSolution = false; return(result); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { UnityRefactorHelperSettingsCommand.Initialize(this); base.Initialize(); Cache.Instance.OleMenuCommandService = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; Cache.Instance.Dte = (DTE)GetService(typeof(SDTE)); var events = Cache.Instance.Dte.Events; _documentEvents = events.DocumentEvents; _buildEvents = events.BuildEvents; Cache.Instance.SolutionService = GetService(typeof(IVsSolution)) as IVsSolution; _solutionEvents = new SolutionEvents(); _solution = GetService(typeof(SVsSolution)) as IVsSolution; _solution.AdviseSolutionEvents(_solutionEvents, out _solutionEventsCookie); _documentEvents.DocumentSaved += DocumentEventsOnDocumentSaved; _buildEvents.OnBuildProjConfigDone += BuildEventsOnOnBuildProjConfigDone; }
int IVsSolutionEvents.OnAfterCloseSolution(object pUnkReserved) { IRecipeManagerService rms = (IRecipeManagerService)GetService(typeof(IRecipeManagerService)); rms.EnabledPackage -= new PackageEventHandler(OnEnabledPackage); //rms.EnablingPackage -= new PackageEventHandler(rms_EnabledPackage); guidanceNavigatorManager.Reset(); if (IsGuidanceNavigatorToolWindowVisible()) { SetGNavAutoClosedKeyValue(true); HideGuidanceNavigatorWindow(); } else { SetGNavAutoClosedKeyValue(false); } IVsSolutionEvents hostService = (IVsSolutionEvents)GetService(typeof(IHostService)); return(hostService.OnAfterCloseSolution(pUnkReserved)); }
int IVsSolution.AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { AdviseSolutionEventsCalled = true; pdwCookie = 1; return VSConstants.S_OK; }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { UnityRefactorHelperSettingsCommand.Initialize(this); base.Initialize(); Cache.Instance.OleMenuCommandService = GetService(typeof (IMenuCommandService)) as OleMenuCommandService; Cache.Instance.Dte = (DTE) GetService(typeof (SDTE)); var events = Cache.Instance.Dte.Events; _documentEvents = events.DocumentEvents; _buildEvents = events.BuildEvents; Cache.Instance.SolutionService = GetService(typeof (IVsSolution)) as IVsSolution; _solutionEvents = new SolutionEvents(); _solution = GetService(typeof (SVsSolution)) as IVsSolution; _solution.AdviseSolutionEvents(_solutionEvents, out _solutionEventsCookie); _documentEvents.DocumentSaved += DocumentEventsOnDocumentSaved; _buildEvents.OnBuildProjConfigDone += BuildEventsOnOnBuildProjConfigDone; }
int IVsSolution.AdviseSolutionEvents(IVsSolutionEvents sink, out uint cookie) { throw new NotImplementedException(); }
public int AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { pdwCookie = 0; return(VSConstants.S_OK); }
int IVsSolution.AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { pdwCookie = (uint)this.sinks.Count + 1; this.sinks.Add(pSink); return(VSConstants.S_OK); }
private void AdviseSolutionEvents() { _vsSolutionEvents = new VsSolutionEvents(this); _vsSolution = (IVsSolution)ServiceProvider.GlobalProvider.GetService(typeof(SVsSolution)); _vsSolution.AdviseSolutionEvents(_vsSolutionEvents, out _); }
public int AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { pdwCookie = 0; return VSConstants.E_NOTIMPL; }
public int AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { throw new NotImplementedException(); }
int IVsSolution.AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { AdviseSolutionEventsCalled = true; pdwCookie = 1; return(VSConstants.S_OK); }
/// <summary> /// Initialization of the package; this method is called right after the package is sited, so this is the place /// where you can put all the initialization code that rely on services provided by VisualStudio. /// </summary> protected override async System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { #if DEBUG if (Environment.GetEnvironmentVariable("DominoDebugVsPackageOnStart") == "1") { System.Diagnostics.Debugger.Launch(); } #endif Debug.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", GetType().ToString())); await base.InitializeAsync(cancellationToken, progress); // do the rest on the UI thread await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); // Create and register our factory RegisterProjectFactory(new ProjectFlavorFactory(this)); var outWindow = GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; Debug.Assert(outWindow != null, "outWindow != null"); // Setup a pane for VsPackage messages var vsPackagePaneGuid = VsPackagePaneGuid; var hResult = outWindow.CreatePane(ref vsPackagePaneGuid, VsPackagePaneName, 1, 0); Marshal.ThrowExceptionForHR(hResult); hResult = outWindow.GetPane(ref vsPackagePaneGuid, out m_packageOutputPane); Marshal.ThrowExceptionForHR(hResult); PrintDebugMessage(Strings.DebugMessageDominoPackgeLoading); try { // Modifying events to listen to Add/Remove/Rename items m_dte = await GetServiceAsync(typeof(DTE)) as DTE; // Setup output pane var buildOutputPaneGuid = VSConstants.GUID_BuildOutputWindowPane; outWindow.GetPane(ref buildOutputPaneGuid, out m_buildOutputPane); // Register solution events (required especially when projects are loaded and unloaded) m_vsSolutionEvents = new SolutionEventsHandler(this); m_vsSolution = await GetServiceAsync(typeof(SVsSolution)) as IVsSolution; ErrorHandler.ThrowOnFailure(m_vsSolution.AdviseSolutionEvents(m_vsSolutionEvents, out m_solutionEventsCookie)); ErrorHandler.ThrowOnFailure(m_vsSolution.AdviseSolutionEvents(this, out m_solutionEventsCookie)); // Initializing an error list to be used for showing errors m_shellOpenDocument = GetGlobalService(typeof(SVsUIShellOpenDocument)) as IVsUIShellOpenDocument; m_textManager = GetGlobalService(typeof(VsTextManagerClass)) as IVsTextManager; m_errorListProvider = new ErrorListProvider(this) { ProviderName = "Build Accelerator", ProviderGuid = new Guid("5A10E43F-8D1D-4026-98C0-E6B502058901"), }; // Sets the global property to verify whether BuildXL package is installed inside Visual studio or not // This helps making the installation of BuildXLVsPackage mandatory var globalcollection = Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection; globalcollection.SetGlobalProperty(Constants.DominoPackageInstalled, "true"); // Helps to ensures to force all users to upgrade to the latest version SetDominoPackageVersion(globalcollection); // Iterate through projects and add events to each project in the solution foreach (Project project in GetAllProjects(m_dte.Solution)) { HandleProject(project); } PrintDebugMessage(Strings.DebugMessageDominoPackageLoadedSuccessful); } catch (Exception e) { PrintDebugMessage(Strings.DebugMessageDominoPackageLoadFailure, e); throw; } }
/// <summary> /// The advise solution events. /// </summary> /// <param name="pSink"> /// The p sink. /// </param> /// <param name="pdwCookie"> /// The pdw cookie. /// </param> /// <returns> /// The advise solution events. /// </returns> public int AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { this._eventSinks.Add(pSink); pdwCookie = (uint)this._eventSinks.Count; return(VSConstants.S_OK); }
public int AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { _eventSinks.Add(pSink); pdwCookie = (uint)_eventSinks.Count; return VSConstants.S_OK; }
public int AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { throw new NotImplementedException(); }
int IVsSolution2.AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { return(((IVsSolution)this).AdviseSolutionEvents(pSink, out pdwCookie)); }
public int AdviseSolutionEvents(IVsSolutionEvents pSink, out uint pdwCookie) { return(_solution.AdviseSolutionEvents(pSink, out pdwCookie)); }
int IVsSolution.AdviseSolutionEvents(IVsSolutionEvents sink, out uint cookie) { throw new NotImplementedException(); }
protected override void Initialize() { m_vsSolutionEvents = new MySolutionEvents(); m_vsSolution = GetService(typeof(SVsSolution)) as IVsSolution; m_vsSolution.AdviseSolutionEvents(m_vsSolutionEvents, out m_SolutionEventsCookie); }