public static BuildCommandIntercepter InitializeCommandInterceptor(IServiceProvider serviceProvider) { if (BuildCommandIntercepter.instance == null) { BuildCommandIntercepter.instance = new BuildCommandIntercepter(serviceProvider); } return(BuildCommandIntercepter.instance); }
private void AdviseBuildEvents() { Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.RunAsync(async() => { UpdateSolutionEventsListener solutionEventsListener = this; await Microsoft.VisualStudio.Shell.ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); solutionEventsListener._buildCommandIntercepter = BuildCommandIntercepter.InitializeCommandInterceptor(solutionEventsListener._serviceProvider); solutionEventsListener._buildCommandIntercepter.UserInitiatedBuild += solutionEventsListener.OnUserInitiatedBuild; }); }
int IOleCommandTarget.Exec(ref Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut) { if (pvaOut == IntPtr.Zero && (BuildCommandIntercepter.IsBuildCommand(pguidCmdGroup, nCmdID) || this.IsProgrammaticBuildCmd(pguidCmdGroup, nCmdID))) { EventHandler <BuildCommandEventArgs> userInitiatedBuild = this.userInitiatedBuild; if (userInitiatedBuild != null) { BuildCommandEventArgs e = new BuildCommandEventArgs(this.IsBuildClean(pguidCmdGroup, nCmdID)); userInitiatedBuild((object)this, e); } } return(-2147221248); }