/// <summary> /// Initializes a new instance of the <see cref="SolutionBuildListener"/> class. /// </summary> /// <param name="serviceProvider">The service provider.</param> public SolutionBuildListener(IServiceProvider serviceProvider) { _serviceProvider = serviceProvider; DTE dte = _serviceProvider.GetService(typeof(DTE)) as DTE; if (dte == null) return; _buildEvents = dte.Events.BuildEvents; try { _buildEvents.OnBuildProjConfigDone += OnBuildProjConfigDone; } catch { } try { _buildEvents.OnBuildBegin += OnBuildBegin; } catch { } try { _buildEvents.OnBuildDone += OnBuildDone; } catch { } }
protected override void Initialize() { _dte = GetService(typeof(DTE)) as DTE2; Package = this; Telemetry.SetDeviceName(_dte.Edition); Logger.Initialize(this, Constants.VSIX_NAME); Events2 events = (Events2)_dte.Events; _solutionEvents = events.SolutionEvents; _solutionEvents.AfterClosing += () => { TableDataSource.Instance.CleanAllErrors(); }; _solutionEvents.ProjectRemoved += (project) => { TableDataSource.Instance.CleanAllErrors(); }; _buildEvents = events.BuildEvents; _buildEvents.OnBuildBegin += OnBuildBegin; CreateConfig.Initialize(this); Recompile.Initialize(this); CompileOnBuild.Initialize(this); RemoveConfig.Initialize(this); CompileAllFiles.Initialize(this); CleanOutputFiles.Initialize(this); base.Initialize(); }
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary> /// <param term='application'>Root object of the host application.</param> /// <param term='connectMode'>Describes how the Add-in is being loaded.</param> /// <param term='addInInst'>Object representing this Add-in.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _application = (DTE2)application; _addInInstance = (AddIn)addInInst; // Core var name = _addInInstance.Name; var outputPane = _application.ToolWindows.OutputWindow.OutputWindowPanes.GetPane(name); var feedback = new FeedbackManager(name, outputPane); _core = new Core(feedback); // Events _events = (Events2)_application.Events; _projectsEvents = _events.ProjectsEvents; _projectItemsEvents = _events.ProjectItemsEvents; _documentEvents = _events.DocumentEvents; _buildEvents = _events.BuildEvents; AttachEvents(); // If being connected when Solution is already loaded - try to load all projects if (_application.Solution != null) { _core.Load(_application.Solution); } }
public Compiler(EventBus eventBus) { _EventBus = eventBus; _BuildEvents = _EventBus.DTE.Events.BuildEvents; _BuildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(BuildEvents_OnBuildBegin); _BuildEvents.OnBuildProjConfigBegin += new _dispBuildEvents_OnBuildProjConfigBeginEventHandler(BuildEvents_OnBuildProjConfigBegin); }
public PackageRestorer(IPackageRestorer restorer) { dte = (DTE)Package.GetGlobalService(typeof(DTE)); buildEvents = dte.Events.BuildEvents; buildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; this.restorer = restorer; }
public BuildProgressService(InstallBakerEventAggregator eventAggregator, BuildEvents buildEvents, Solution currentSolution) : base(eventAggregator) { _buildEvents = buildEvents; _currentSolution = currentSolution; _availableProjectsDict = new Dictionary<string, ProjectInfo>(); HookEvents(); }
/// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary> /// <param term='application'>Root object of the host application.</param> /// <param term='connectMode'>Describes how the Add-in is being loaded.</param> /// <param term='addInInst'>Object representing this Add-in.</param> /// <seealso class='IDTExtensibility2' /> public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom) { _applicationObject = (DTE2)application; _addInInstance = (AddIn)addInInst; buildBegin = _applicationObject.Events.BuildEvents; buildDone = _applicationObject.Events.BuildEvents; System.Diagnostics.Debug.WriteLine("Connected!"); }
public ProductStateValidator(IServiceProvider serviceProvider) { Guard.NotNull(() => serviceProvider, serviceProvider); this.patternManager = serviceProvider.GetService<IPatternManager>(); this.buildEvents = serviceProvider.GetService<SDTE, DTE>().Events.BuildEvents; this.buildEvents.OnBuildDone += OnBuildDone; }
protected override void Initialize() { base.Initialize(); dte = GetService(typeof(SDTE)) as DTE; buildEvents = dte.Events.BuildEvents; buildEvents.OnBuildBegin += OnBuildBegin; }
public VisualStudioConnection(Package package) { _package = package; _dte = (DTE2)Package.GetGlobalService(typeof(DTE)); _solutionEvents = ((Events2)_dte.Events).SolutionEvents; _buildEvents = ((Events2)_dte.Events).BuildEvents; _subject = new Subject<EventType>(); }
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInstance, ref Array custom) { _applicationObject = (DTE2)application; _buildEvents = _applicationObject.Events.BuildEvents; _buildEvents.OnBuildBegin += OnBuildBegin; _buildEvents.OnBuildProjConfigDone += OnBuildProjConfigDone; _buildEvents.OnBuildDone += OnBuildDone; }
private void bindEventsOnBuild() { if (_buildEvents != null) return; _buildEvents = _applicationObject.Events.BuildEvents; _buildCompletedEvent = new _dispBuildEvents_OnBuildDoneEventHandler(BuildEvents_OnBuildDone); _buildEvents.OnBuildDone += _buildCompletedEvent; }
protected override void Dispose(bool disposing) { UnadviseSolutionEvents(); Cache.Instance.Dispose(); _buildEvents = null; _documentEvents = null; _solutionEvents = null; base.Dispose(disposing); }
public PackageRestorer(DTE dte, IServiceProvider serviceProvider) { _dte = dte; _errorListProvider = new ErrorListProvider(serviceProvider); _buildEvents = dte.Events.BuildEvents; _buildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; _solutionEvents = dte.Events.SolutionEvents; _solutionEvents.AfterClosing += SolutionEvents_AfterClosing; }
public DteWithEvents(DTE dte) { DTE = dte; SolutionEvents = dte.Events.SolutionEvents; ProjectItemsEvents = ((Events2)dte.Events).ProjectItemsEvents; DocumentEvents = ((Events2) dte.Events).DocumentEvents; BuildEvents = ((Events2) dte.Events).BuildEvents; CodeModelEvents = ((Events2)dte.Events).CodeModelEvents; }
protected override int QueryClose(out bool canClose) { int result = base.QueryClose(out canClose); if (canClose && buildEvents != null) { buildEvents.OnBuildBegin -= OnBuildBegin; buildEvents = null; } 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() { base.Initialize(); m_dte = (DTE2)GetGlobalService(typeof(EnvDTE.DTE)); m_buildEvents = m_dte.Events.BuildEvents; m_buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(OnBuildBegin); }
private AvaloniaBuildEvents() { if (Equals(Registry.GetValue(@"HKEY_CURRENT_USER\Software\AvaloniaUI\Designer", "AllocConsole", 0), 1)) CreateConsole(); var dte = (DTE) Package.GetGlobalService(typeof (DTE)); _buildEvents = dte.Events.BuildEvents; _buildEvents.OnBuildBegin += PdbeBuildBegin; _buildEvents.OnBuildDone += NotifyBuildEnd; _dteEvents = dte.Events.DTEEvents; _dteEvents.ModeChanged += NotifyModeChanged; }
public BuildEventsHandler(DevUtilsPackage pkg) { _vspkg = pkg; _buildEvents = pkg.dte.Events.BuildEvents; _buildEvents.OnBuildBegin += buildStarted; _buildEvents.OnBuildDone += buildDone; _buildEvents.OnBuildProjConfigDone += buildProjDone; _taskbarItemInfo = Application.Current.MainWindow.TaskbarItemInfo; if (_taskbarItemInfo == null) Application.Current.MainWindow.TaskbarItemInfo = _taskbarItemInfo = new TaskbarItemInfo(); }
private CleanErrorsCommand(Package package) { _package = package; _events = WebLinterPackage.Dte.Events.BuildEvents; _events.OnBuildBegin += OnBuildBegin; OleMenuCommandService commandService = ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; var menuCommandID = new CommandID(PackageGuids.WebLinterCmdSet, PackageIds.CleanErrorsCommand); var menuItem = new OleMenuCommand(CleanErrors, menuCommandID); menuItem.BeforeQueryStatus += BeforeQueryStatus; commandService.AddCommand(menuItem); }
public SolutionBuildTimings(Plugin plugin) { m_plugin = plugin; m_buildEvents = ((EnvDTE80.Events2)plugin.App.Events).BuildEvents; m_buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(OnBuildBegin); m_buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(OnBuildDone); m_timer = new Stopwatch(); Options options = (Options)plugin.Options; m_logfilename = options.CompileTimeLogFile; }
public DteWithEvents(DTE dte, IIdeTracer tracer) { DTE = dte; SolutionEvents = dte.Events.SolutionEvents; ProjectItemsEvents = ((Events2)dte.Events).ProjectItemsEvents; DocumentEvents = ((Events2)dte.Events).DocumentEvents; BuildEvents = ((Events2)dte.Events).BuildEvents; CodeModelEvents = ((Events2)dte.Events).CodeModelEvents; SolutionEventsListener = new SolutionEventsListener(); FileChangeEventsListener = new FileChangeEventsListener(tracer); SolutionEvents.BeforeClosing += FileChangeEventsListener.StopListening; }
/// <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 initilaization code that rely on services provided by VisualStudio. /// </summary> protected override void Initialize() { Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString())); base.Initialize(); //Create Editor Factory. Note that the base Package class will call Dispose on it. base.RegisterEditorFactory(new EditorFactory(this)); _dte = (EnvDTE.DTE)GetService(typeof(EnvDTE.DTE)); SetNDKPath(); GetInstalledAPIList(); GetAvailableAPIList(); GetInstalledSimulatorList(); GetSimulatorList(); _commandEvents = new VSNDKCommandEvents((DTE2)_dte); _commandEvents.RegisterCommand(GuidList.guidVSStd97String, CommandConstants.cmdidStartDebug, startDebugCommandEvents_AfterExecute, startDebugCommandEvents_BeforeExecute); _buildEvents = _dte.Events.BuildEvents; _buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin); // Add our command handlers for menu (commands must exist in the .vsct file) OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { // Create the command for the tool window CommandID toolwndCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryTools); MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID); mcs.AddCommand(menuToolWin); // Create the command for the settings window CommandID wndSettingsCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerrySettings); MenuCommand menuSettingsWin = new MenuCommand(ShowSettingsWindow, wndSettingsCommandID); mcs.AddCommand(menuSettingsWin); // Create the command for the Debug Token window CommandID wndDebugTokenCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidBlackBerryDebugToken); MenuCommand menuDebugTokenWin = new MenuCommand(ShowDebugTokenWindow, wndDebugTokenCommandID); mcs.AddCommand(menuDebugTokenWin); // Create the command for the menu item. CommandID projCommandID = new CommandID(GuidList.guidVSNDK_PackageCmdSet, (int)PkgCmdIDList.cmdidfooLocalBox); OleMenuCommand projItem = new OleMenuCommand(MenuItemCallback, projCommandID); mcs.AddCommand(projItem); } }
public void TextViewCreated(IWpfTextView textView) { ThreadHelper.ThrowIfNotOnUIThread(); _adornment = new ViewportAdornment(textView); if (ServiceProvider.GetService(typeof(DTE)) is DTE dte) { _buildEvents = dte.Events.BuildEvents; dte.Events.BuildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; dte.Events.BuildEvents.OnBuildDone += BuildEvents_OnBuildDone; dte.Events.BuildEvents.OnBuildProjConfigDone += BuildEvents_OnBuildProjConfigDone; } }
public void UnregisterEvents() { //logger.LogMessage("UnRegistering events"); Microsoft.VisualStudio.Shell.Events.SolutionEvents.OnAfterBackgroundSolutionLoadComplete -= SolutionEvents_OnAfterBackgroundSolutionLoadComplete; Microsoft.VisualStudio.Shell.Events.SolutionEvents.OnAfterCloseSolution -= SolutionEvents_OnAfterCloseSolution; BuildEvents.OnBuildBegin -= BuildEvents_OnBuildBegin; BuildEvents.OnBuildDone -= BuildEvents_OnBuildDone; DebuggerEvents.OnEnterRunMode -= DebuggerEvents_OnEnterRunMode; DebuggerEvents.OnEnterDesignMode -= DebuggerEvents_OnEnterDesignMode; BuildEvents = null; DebuggerEvents = null; }
protected override int QueryClose(out bool canClose) { int result = base.QueryClose(out canClose); if (!canClose) return result; if (_buildEvents != null) { _buildEvents.OnBuildBegin -= OnBuildBegin; _buildEvents.OnBuildDone -= OnBuildDone; _buildEvents = null; } return result; }
public OutputConsoleLogger(IServiceProvider serviceProvider) { ErrorListProvider = new ErrorListProvider(serviceProvider); var outputConsoleProvider = ServiceLocator.GetInstance <IOutputConsoleProvider>(); _dte = ServiceLocator.GetInstance <DTE>(); _buildEvents = _dte.Events.BuildEvents; _buildEvents.OnBuildBegin += (obj, ev) => { ErrorListProvider.Tasks.Clear(); }; _solutionEvents = _dte.Events.SolutionEvents; _solutionEvents.AfterClosing += () => { ErrorListProvider.Tasks.Clear(); }; OutputConsole = outputConsoleProvider.CreateOutputConsole(requirePowerShellHost: false); }
public BuildEventsHandler(DevUtilsPackage pkg) { _vspkg = pkg; _buildEvents = pkg.dte.Events.BuildEvents; _buildEvents.OnBuildBegin += buildStarted; _buildEvents.OnBuildDone += buildDone; _buildEvents.OnBuildProjConfigDone += buildProjDone; _taskbarItemInfo = Application.Current.MainWindow.TaskbarItemInfo; if (_taskbarItemInfo == null) { Application.Current.MainWindow.TaskbarItemInfo = _taskbarItemInfo = new TaskbarItemInfo(); } }
public DteWithEvents(DTE dte, IIdeTracer tracer) { DTE = dte; SolutionEvents = dte.Events.SolutionEvents; ProjectItemsEvents = ((Events2)dte.Events).ProjectItemsEvents; DocumentEvents = ((Events2) dte.Events).DocumentEvents; BuildEvents = ((Events2) dte.Events).BuildEvents; CodeModelEvents = ((Events2)dte.Events).CodeModelEvents; SolutionEventsListener = new SolutionEventsListener(); FileChangeEventsListener = new FileChangeEventsListener(tracer); SolutionEvents.BeforeClosing += FileChangeEventsListener.StopListening; }
/// <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 Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // Switches to the UI thread in order to consume some services used in command initialization await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await RegisterVsServicesAsync(); mCommandController = new CommandController(this); CommandTestUtility.CommandController = mCommandController; var vsOutputWindow = VsServiceProvider.GetService(typeof(SVsOutputWindow)) as IVsOutputWindow; mOutputWindowController = new OutputWindowController(); mOutputWindowController.Initialize(this, vsOutputWindow); mRunningDocTableEvents = new RunningDocTableEvents(this); mErrorWindowController = new ErrorWindowController(this); #region Get Pointer to IVsSolutionEvents if (VsServiceProvider.TryGetService(typeof(SVsSolution), out object vsSolutionService)) { var vsSolution = vsSolutionService as IVsSolution; UnadviseSolutionEvents(vsSolution); AdviseSolutionEvents(vsSolution); } #endregion // Get the build and command events from DTE if (VsServiceProvider.TryGetService(typeof(DTE), out object dte)) { var dte2 = dte as DTE2; mBuildEvents = dte2.Events.BuildEvents; mCommandEvents = dte2.Events.CommandEvents; mDteEvents = dte2.Events.DTEEvents; } mSettingsHandler = new SettingsHandler(); mSettingsHandler.InitializeSettings(); await mCommandController.InitializeCommandsAsync(this); mLicenseController = new LicenseController(); RegisterToEvents(); await mLicenseController.CheckLicenseAsync(); await base.InitializeAsync(cancellationToken, progress); }
public FuturaPlanConfigWardenControl(WindowState state) { Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(); _state = state; m_dbCache = new DbCache(); if (m_dbCache.TryGetCacheData(out ObservableCollection <string> data, out string active, out string server)) { DatabaseList = data; SelectedDatabase = active; CurrentServer = server; } else { DatabaseList = new ObservableCollection <string>(); CurrentServer = "localhost"; } DataContext = this; m_buildEvents = _state.DTE.Events.BuildEvents; m_solutionEvents = _state.DTE.Events.SolutionEvents; m_buildEvents.OnBuildBegin += BuildStart; m_buildEvents.OnBuildDone += BuildEnd; m_solutionEvents.Opened += () => { if (AppConfig != null) { return; } if (TryGetAppConfig(out ProjectItem aconf)) { SetAppConfig(aconf); m_originalConnectionString = ConnectionStringElement.Value; } }; if (TryGetAppConfig(out ProjectItem aconf)) { SetAppConfig(aconf); m_originalConnectionString = ConnectionStringElement.Value; } SetConnectionString(m_originalConnectionString); InitializeComponent(); }
public int OnBeforeCloseSolution(object pUnkReserved) { this.eventsHandler.OnVsEventSolutionBeforeClose(); if (this.buildEvents != null) { this.buildEvents.OnBuildProjConfigDone -= OnBuildProjConfigDone; //this.buildEvents.OnBuildBegin -= OnBuildBegin; this.buildEvents = null; } this.dteEvents = null; return(VSConstants.S_OK); }
public void Dispose() { _errorListProvider.Dispose(); var buildEvents = _buildEvents; if (buildEvents == null) { return; } buildEvents.OnBuildBegin -= BuildEvents_OnBuildBegin; _buildEvents = null; }
public SolutionBuildTimings(Plugin plugin) { m_pane = Plugin.FindOutputPane(plugin.App, "Build"); if (null == m_pane) return; m_buildEvents = ((EnvDTE80.Events2)plugin.App.Events).BuildEvents; m_buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(OnBuildBegin); m_buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(OnBuildDone); m_timer = new Stopwatch(); Options options = (Options)plugin.Options; m_logfilename = options.CompileTimeLogFile; }
public LeakBaseClass(object[] args) : base(args) { _perfGraphToolWindowControl.TabControl.SelectedIndex = 1; // select graph tab BuildEvents = _dte.Events.BuildEvents; DebuggerEvents = _dte.Events.DebuggerEvents; Microsoft.VisualStudio.Shell.Events.SolutionEvents.OnAfterBackgroundSolutionLoadComplete += SolutionEvents_OnAfterBackgroundSolutionLoadComplete; Microsoft.VisualStudio.Shell.Events.SolutionEvents.OnAfterCloseSolution += SolutionEvents_OnAfterCloseSolution; BuildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; BuildEvents.OnBuildDone += BuildEvents_OnBuildDone; DebuggerEvents.OnEnterRunMode += DebuggerEvents_OnEnterRunMode; DebuggerEvents.OnEnterDesignMode += DebuggerEvents_OnEnterDesignMode; }
/// <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() { ThreadHelper.ThrowIfNotOnUIThread(); VsHelper.Initialize(this); ScriptGenAssemblyCache.TryClearCache(); _buildEvents = VsHelper.Current.Dte.Events.BuildEvents; _buildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; _buildEvents.OnBuildDone += BuildEvents_OnBuildDone; AddConfigCommand.Initialize(this); GenerateScriptsCommand.Initialize(this); InstallNugetPackageCommand.Initialize(this); ClearCacheCommand.Initialize(this); base.Initialize(); }
public BuildOnSave(Package package) { IServiceProvider serviceProvider = package; _dte = serviceProvider.GetService(typeof(DTE)) as DTE; _events = _dte.Events; _documentEvents = _events.DocumentEvents; _buildEvents = _events.BuildEvents; var guid = typeof(VSConstants.VSStd97CmdID).GUID.ToString("B"); _buildSolutionEvent = _dte.Events.CommandEvents[guid, (int)VSConstants.VSStd97CmdID.BuildSln]; var commandService = serviceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; _topMenu = new MenuCommand(delegate { }, new CommandID(CommandSet, TopMenuCommandId)); _menuItem = new MenuCommand(enableDisableBuildOnSave, new CommandID(CommandSet, CommandId)); _disableWhenDebugging = new MenuCommand(enableDisableWhenDebugging, new CommandID(CommandSet, DisableWhenDebuggingCommandId)); _relaunchNewBuildWhenSaved = new MenuCommand(enableRelaunchNewBuildWhenSaved, new CommandID(CommandSet, RelaunchNewBuildWhenSavedCommandId)); _buildTypeSolution = new MenuCommand(setBuildTypeToSolution, new CommandID(CommandSet, BuildTypeSolutionCommandId)); _buildTypeStartupProject = new MenuCommand(setBuildTypeToStartupProject, new CommandID(CommandSet, BuildTypeStartupProjectCommandId)); commandService.AddCommand(_topMenu); commandService.AddCommand(_menuItem); commandService.AddCommand(_disableWhenDebugging); commandService.AddCommand(_relaunchNewBuildWhenSaved); commandService.AddCommand(_buildTypeSolution); commandService.AddCommand(_buildTypeStartupProject); // create the output pane. _outputWindow = _dte.Windows.Item(Constants.vsWindowKindOutput); _outputPane = ((OutputWindow)_outputWindow.Object).OutputWindowPanes.Add("BuildOnSave"); _topMenu.Visible = true; _solutionOptions = DefaultOptions; Log.I("BuildOnSave initialized"); syncOptions(); }
public DteEventsHandler(DTE _dte) { ThreadHelper.ThrowIfNotOnUIThread(); dte = _dte; var events = dte.Events as Events2; buildEvents = events.BuildEvents; buildEvents.OnBuildBegin += buildEvents_OnBuildBegin; buildEvents.OnBuildProjConfigBegin += OnBuildProjConfigBegin; documentEvents = events.get_DocumentEvents(null); documentEvents.DocumentSaved += DocumentSaved; projectItemsEvents = events.ProjectItemsEvents; projectItemsEvents.ItemAdded += ProjectItemsEvents_ItemAdded; projectItemsEvents.ItemRemoved += ProjectItemsEvents_ItemRemoved; projectItemsEvents.ItemRenamed += ProjectItemsEvents_ItemRenamed; solutionEvents = events.SolutionEvents; solutionEvents.ProjectAdded += SolutionEvents_ProjectAdded; solutionEvents.ProjectRemoved += SolutionEvents_ProjectRemoved; solutionEvents.Opened += SolutionEvents_Opened; solutionEvents.AfterClosing += SolutionEvents_AfterClosing; windowEvents = events.WindowEvents; windowEvents.WindowActivated += WindowEvents_WindowActivated; var debugCommandsGUID = "{5EFC7975-14BC-11CF-9B2B-00AA00573819}"; debugStartEvents = events.get_CommandEvents(debugCommandsGUID, 295); debugStartEvents.BeforeExecute += debugStartEvents_BeforeExecute; debugStartWithoutDebuggingEvents = events.get_CommandEvents(debugCommandsGUID, 368); debugStartWithoutDebuggingEvents.BeforeExecute += debugStartWithoutDebuggingEvents_BeforeExecute; f1HelpEvents = events.get_CommandEvents( typeof(VSConstants.VSStd97CmdID).GUID.ToString("B"), (int)VSConstants.VSStd97CmdID.F1Help); f1HelpEvents.BeforeExecute += F1HelpEvents_BeforeExecute; dispId_VCFileConfiguration_ExcludedFromBuild = GetPropertyDispId(typeof(VCFileConfiguration), "ExcludedFromBuild"); dispId_VCCLCompilerTool_UsePrecompiledHeader = GetPropertyDispId(typeof(VCCLCompilerTool), "UsePrecompiledHeader"); dispId_VCCLCompilerTool_PrecompiledHeaderThrough = GetPropertyDispId(typeof(VCCLCompilerTool), "PrecompiledHeaderThrough"); dispId_VCCLCompilerTool_PreprocessorDefinitions = GetPropertyDispId(typeof(VCCLCompilerTool), "PreprocessorDefinitions"); dispId_VCCLCompilerTool_AdditionalIncludeDirectories = GetPropertyDispId(typeof(VCCLCompilerTool), "AdditionalIncludeDirectories"); InitializeVCProjects(); }
private CleanCommand(Package package, OleMenuCommandService commandService) { _package = package; var cmdId = new CommandID(PackageGuids.guidLibraryInstallerPackageCmdSet, PackageIds.Clean); var cmd = new OleMenuCommand(ExecuteAsync, cmdId); cmd.BeforeQueryStatus += BeforeQueryStatus; commandService.AddCommand(cmd); _buildEvents = VsHelpers.DTE.Events.BuildEvents; _buildEvents.OnBuildBegin += OnBuildBegin; _solutionEvents = VsHelpers.DTE.Events.SolutionEvents; _solutionEvents.AfterClosing += AfterClosing; }
private void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { if (this.buildEvents != null) { this.buildEvents.OnBuildDone -= OnBuildDone; this.buildEvents = null; } } this.disposed = true; } }
public void EndWork() { this.buttonBuildSolution.Click -= new EventHandler <ThumbnailButtonClickedEventArgs>(this.buttonBuildSolution_Click); this.buttonDebug.Click -= new EventHandler <ThumbnailButtonClickedEventArgs>(this.buttonDebug_Click); this.buttonRun.Click -= new EventHandler <ThumbnailButtonClickedEventArgs>(this.buttonRun_Click); this.DisableToolbar(); this._buildEvents = this._applicationObject.Events.BuildEvents; this._buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(OnBuildBegin); this._buildEvents.OnBuildDone -= new _dispBuildEvents_OnBuildDoneEventHandler(OnBuildDone); this._debuggerEvents = this._applicationObject.Events.DebuggerEvents; this._debuggerEvents.OnEnterRunMode += (new _dispDebuggerEvents_OnEnterRunModeEventHandler(this.OnEnterRunMode)); this._debuggerEvents.OnEnterDesignMode -= (new _dispDebuggerEvents_OnEnterDesignModeEventHandler(this.OnEnterDesignMode)); this._solutionEvents = this._applicationObject.Events.SolutionEvents; this._solutionEvents.Opened -= (new _dispSolutionEvents_OpenedEventHandler(this.EnableToolbar)); this._solutionEvents.AfterClosing -= (new _dispSolutionEvents_AfterClosingEventHandler(this.DisableToolbar)); }
protected override int QueryClose(out bool canClose) { int result = base.QueryClose(out canClose); if (!canClose) { return(result); } if (_buildEvents != null) { _buildEvents.OnBuildBegin -= OnBuildBegin; _buildEvents = null; } return(result); }
public DTEEventSource(Events2 events) { _buildEvents = events.BuildEvents; _dteEvents = events.DTEEvents; _debuggerEvents = events.DebuggerEvents; _debuggerProcessEvents = events.DebuggerProcessEvents; _debuggerExpressionEvaluationEvents = events.DebuggerExpressionEvaluationEvents; _findEvents = events.FindEvents; _miscFileEvents = events.MiscFilesEvents; _projectItemsEvents = events.ProjectItemsEvents; _projectEvents = events.ProjectsEvents; _publishEvents = events.PublishEvents; _selectionEvents = events.SelectionEvents; _solutionEvents = events.SolutionEvents; _solutionItemEvents = events.SolutionItemsEvents; }
public DTEEventSource( Events2 events) { _buildEvents = events.BuildEvents; _dteEvents = events.DTEEvents; _debuggerEvents = events.DebuggerEvents; _debuggerProcessEvents = events.DebuggerProcessEvents; _debuggerExpressionEvaluationEvents = events.DebuggerExpressionEvaluationEvents; _findEvents = events.FindEvents; _miscFileEvents = events.MiscFilesEvents; _projectItemsEvents = events.ProjectItemsEvents; _projectEvents = events.ProjectsEvents; _publishEvents = events.PublishEvents; _selectionEvents = events.SelectionEvents; _solutionEvents = events.SolutionEvents; _solutionItemEvents = events.SolutionItemsEvents; }
/// <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> /// <param name="cancellationToken">A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down.</param> /// <param name="progress">A provider for progress updates.</param> /// <returns>A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method.</returns> protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress <ServiceProgressData> progress) { // When initialized asynchronously, the current thread may be a background thread at this point. // Do any initialization that requires the UI thread after switching to the UI thread. await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); await ToolsCommand.InitializeAsync(this); applicationObject = (DTE2) await GetServiceAsync(typeof(DTE)); Assumes.Present(applicationObject); Events events = applicationObject.Events; buildEvents = (BuildEvents)events.BuildEvents; buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone); }
/// <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() { base.Initialize(); try { string localOptInRegKeyVsCurrent = VS14OptInRegKey; string localOptInRegKeyVsNext = VS15OptInRegKey; // modify the registry key path to account for OS architecture if (Environment.Is64BitOperatingSystem == false) { localOptInRegKeyVsCurrent = localOptInRegKeyVsCurrent.Replace(@"\WOW6432Node", string.Empty); localOptInRegKeyVsNext = localOptInRegKeyVsNext.Replace(@"\WOW6432Node", string.Empty); } // check registry for opt in accounting for null values if key doesn't exist int? vsCurrentOptIn = (int?)Registry.GetValue(localOptInRegKeyVsCurrent, OptInRegValue, 0); int? vsNextOptIn = (int?)Registry.GetValue(localOptInRegKeyVsNext, OptInRegValue, 0); int? userOptedIn = vsCurrentOptIn.GetValueOrDefault() + vsNextOptIn.GetValueOrDefault(); int? microsoftInternalUser = (int?)Registry.GetValue(BuildMonitor.MsftInternalRegKey, BuildMonitor.MsftInternalRegValue, 0); microsoftInternalUser = microsoftInternalUser.GetValueOrDefault(); if (!(userOptedIn == 0 && microsoftInternalUser == 0)) { DTE dte = GetService(typeof(SDTE)) as DTE; if (dte == null) { throw new InvalidOperationException("No Visual Studio Desktop Environment service (SDTE) available!"); } _buildEvents = dte.Events.BuildEvents; _buildEvents.OnBuildBegin += ProcessBuildBeginEvents; _buildEvents.OnBuildDone += ProcessBuildDoneEvents; IVsSolution solution = (IVsSolution)GetService(typeof(SVsSolution)); if (solution == null) { throw new InvalidOperationException("No Visual Studio Solution service (SVsSolution) available!"); } _eventProcessor = new BuildEventProcessor(dte, solution, (microsoftInternalUser != 0)); } } catch { } }
public BuildOnSave(Package package) { IServiceProvider serviceProvider = package; _dte = serviceProvider.GetService(typeof(DTE)) as DTE; _events = _dte.Events; _documentEvents = _events.DocumentEvents; _buildEvents = _events.BuildEvents; var guid = typeof(VSConstants.VSStd97CmdID).GUID.ToString("B"); _buildSolutionEvent = _dte.Events.CommandEvents[guid, (int)VSConstants.VSStd97CmdID.BuildSln]; var commandService = serviceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; _topMenu = new MenuCommand(delegate { }, new CommandID(CommandSet, TopMenuCommandId)); _menuItem = new MenuCommand(enableDisableBuildOnSave, new CommandID(CommandSet, CommandId)); _buildTypeSolution = new MenuCommand(setBuildTypeToSolution, new CommandID(CommandSet, BuildTypeSolutionCommandId)); _buildTypeStartupProject = new MenuCommand(setBuildTypeToStartupProject, new CommandID(CommandSet, BuildTypeStartupProjectCommandId)); _buildTypeProjectsOfSavedFiles = new MenuCommand(setBuildTypeToProjectsOfSavedFiles, new CommandID(CommandSet, BuildTypeProjectsOfSavedFilesCommandId)); _buildTypeAffectedProjectsOfSavedFiles = new MenuCommand(setBuildTypeToAffectedProjectsOfSavedFiels, new CommandID(CommandSet, BuildTypeAffectedProjectsOfSavedFilesCommandId)); commandService.AddCommand(_topMenu); commandService.AddCommand(_menuItem); commandService.AddCommand(_buildTypeSolution); commandService.AddCommand(_buildTypeStartupProject); commandService.AddCommand(_buildTypeProjectsOfSavedFiles); commandService.AddCommand(_buildTypeAffectedProjectsOfSavedFiles); // create the output pane. _outputWindow = _dte.Windows.Item(Constants.vsWindowKindOutput); _outputPane = ((OutputWindow)_outputWindow.Object).OutputWindowPanes.Add("BuildOnSave"); _topMenu.Visible = true; _solutionOptions = DefaultOptions; Log.I("BuildOnSave initialized"); syncOptions(); }
public EditorContext() { //Initialize events _context = Package.GetGlobalService(typeof(DTE)) as DTE; _solutionEvents = _context.Events.SolutionEvents; _buildEvents = _context.Events.BuildEvents; _solutionEvents.Opened += OnSolutionOpened; _solutionEvents.BeforeClosing += OnSolutionClosing; _buildEvents.OnBuildBegin += OnBuildBegin; _buildEvents.OnBuildDone += OnBuildDone; //Initialize log pane _outputWindow = Package.GetGlobalService(typeof(SVsOutputWindow)) as IVsOutputWindow; _outputWindow.CreatePane(VSConstants.OutputWindowPaneGuid.GeneralPane_guid, "AxoCover", 1, 1); _outputWindow.GetPane(VSConstants.OutputWindowPaneGuid.GeneralPane_guid, out _outputPane); }
private CleanCommand(AsyncPackage package, OleMenuCommandService commandService, ILibraryCommandService libraryCommandService) { _libraryCommandService = libraryCommandService; var cmdId = new CommandID(PackageGuids.guidLibraryManagerPackageCmdSet, PackageIds.Clean); var cmd = new OleMenuCommand((s, e) => package.JoinableTaskFactory.RunAsync(() => ExecuteAsync()), cmdId); cmd.BeforeQueryStatus += (s, e) => package.JoinableTaskFactory.RunAsync(() => BeforeQueryStatusAsync(s, e)); commandService.AddCommand(cmd); _buildEvents = VsHelpers.DTE.Events.BuildEvents; _buildEvents.OnBuildBegin += OnBuildBegin; _solutionEvents = VsHelpers.DTE.Events.SolutionEvents; _solutionEvents.AfterClosing += AfterClosing; }
private ClearAllErrorsCommand(Package package, OleMenuCommandService commandService) { _package = package; var dte = (DTE2)Package.GetGlobalService(typeof(DTE)); _events = dte.Events.BuildEvents; _events.OnBuildBegin += OnBuildBegin; if (commandService != null) { var id = new CommandID(PackageGuids.guidPackageCmdSet, PackageIds.ClearAllErrors); var cmd = new OleMenuCommand(MenuItemCallback, id); cmd.BeforeQueryStatus += BeforeQueryStatus; commandService.AddCommand(cmd); } }
void buildEvents_OnBuildDone(vsBuildScope Scope, vsBuildAction Action) { _buildEvents.OnBuildDone -= buildEvents_OnBuildDone; _buildEvents = null; DTE2 dte = (DTE2)GetService(typeof(SDTE)); OutputWindow outputWindow = (OutputWindow)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput).Object; OutputWindowPane activePane = outputWindow.ActivePane; if (activePane == null) { activePane = outputWindow.OutputWindowPanes.Item("Build"); } ProvisionProject(dte, activePane, _targetProject); _targetProject = null; }
public void Startup() { this.buttonBuildSolution.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(this.buttonBuildSolution_Click); this.buttonDebug.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(this.buttonDebug_Click); this.buttonRun.Click += new EventHandler <ThumbnailButtonClickedEventArgs>(this.buttonRun_Click); _taskbarManager.ThumbnailToolBars.AddButtons((IntPtr)this._applicationObject.MainWindow.HWnd, new ThumbnailToolBarButton[] { this.buttonBuildSolution, this.buttonDebug, this.buttonRun }); this.DisableToolbar(); this._buildEvents = this._applicationObject.Events.BuildEvents; this._buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(OnBuildBegin); this._buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(OnBuildDone); this._debuggerEvents = this._applicationObject.Events.DebuggerEvents; this._debuggerEvents.OnEnterRunMode += (new _dispDebuggerEvents_OnEnterRunModeEventHandler(this.OnEnterRunMode)); this._debuggerEvents.OnEnterDesignMode += (new _dispDebuggerEvents_OnEnterDesignModeEventHandler(this.OnEnterDesignMode)); this._solutionEvents = this._applicationObject.Events.SolutionEvents; this._solutionEvents.Opened += (new _dispSolutionEvents_OpenedEventHandler(this.EnableToolbar)); this._solutionEvents.AfterClosing += (new _dispSolutionEvents_AfterClosingEventHandler(this.DisableToolbar)); }
public static async Task InitializeAsync(AsyncPackage package) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken); IVsOutputWindow outWindow = await package.GetServiceAsync <SVsOutputWindow, IVsOutputWindow>(); Assumes.Present(outWindow); outWindow.GetPane(VSConstants.OutputWindowPaneGuid.SortedBuildOutputPane_guid, out IVsOutputWindowPane buildPane); DTE2 dte = await package.GetServiceAsync <DTE, DTE2>(); Assumes.Present(dte); _buildEvents = dte.Events.BuildEvents; _buildEvents.OnBuildDone += (s, a) => OnBuildDone(a, buildPane); }
protected override void Initialize() { base.Initialize(); _dte = GetService(typeof(DTE)) as DTE2; _events = _dte.Events.BuildEvents; _events.OnBuildDone += OnBuildDone; OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { CommandID fartCmd = new CommandID(GuidList.guidFarticusCmdSet, (int)PkgCmdIDList.cmdidRandomFart); MenuCommand menuItem = new MenuCommand(OnFartButtonClick, fartCmd); mcs.AddCommand(menuItem); } }
protected override void Initialize() { base.Initialize(); _dte = GetService(typeof(DTE)) as DTE2; _events = _dte.Events.BuildEvents; _events.OnBuildDone += OnBuildDone; OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService; if (null != mcs) { CommandID fartCmd = new CommandID(PackageGuids.guidFarticusCmdSet, PackageIds.cmdidRandomFart); MenuCommand menuItem = new MenuCommand(OnFartButtonClick, fartCmd); mcs.AddCommand(menuItem); } }
public CosmosProjectNode(CosmosProjectPackage package) { Logger.TraceMethod(MethodBase.GetCurrentMethod()); Package = package; var dte = (DTE)((IServiceProvider)Package).GetService(typeof(DTE)); mBuildEvents = dte.Events.BuildEvents; //mBuildEvents.OnBuildProjConfigDone += OnBuildProjConfigDone; mImageIndex = ImageHandler.ImageList.Images.Count; foreach (Image img in mImageList.Images) { ImageHandler.AddImage(img); } }
public void Initialize(DTE dte) { _dte = dte; _buildEvents = dte.Events.BuildEvents; _buildEvents.OnBuildBegin += BuildEvents_OnBuildBegin; // get the "Build" output window pane var dte2 = (DTE2)dte; var buildWindowPaneGuid = VSConstants.BuildOutput.ToString("B"); foreach (OutputWindowPane pane in dte2.ToolWindows.OutputWindow.OutputWindowPanes) { if (String.Equals(pane.Guid, buildWindowPaneGuid, StringComparison.OrdinalIgnoreCase)) { _outputPane = pane; break; } } }
public OutputConsoleLogger(IServiceProvider serviceProvider) { ErrorListProvider = new Microsoft.VisualStudio.Shell.ErrorListProvider(serviceProvider); var outputConsoleProvider = ServiceLocator.GetInstance<IOutputConsoleProvider>(); var dte = ServiceLocator.GetInstance<DTE>(); _buildEvents = dte.Events.BuildEvents; _buildEvents.OnBuildBegin += (obj, ev) => { ErrorListProvider.Tasks.Clear(); }; _solutionEvents = dte.Events.SolutionEvents; _solutionEvents.AfterClosing += () => { ErrorListProvider.Tasks.Clear(); }; OutputConsole = outputConsoleProvider.CreateOutputConsole(requirePowerShellHost: false); }