/// <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 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; }
private void Init() { Events2 events2 = (Events2)_applicationObject.Events; if ((advisementResult = (uint)_ptrSolution.AdviseSolutionEvents(this, out pdwCookie)) != S_OK) { Debug.WriteLine("!!! Unable to hook into the advisement of solution events. !!!"); } // Build Events this._buildEvents = events2.BuildEvents; this._buildEvents.OnBuildBegin += _buildEvents_OnBuildBegin; this._buildEvents.OnBuildDone += _buildEvents_OnBuildDone; this._buildEvents.OnBuildProjConfigBegin += _buildEvents_OnBuildProjConfigBegin; this._buildEvents.OnBuildProjConfigDone += _buildEvents_OnBuildProjConfigDone; // Solution Events this._solutionEvents = events2.SolutionEvents; this._solutionEvents.AfterClosing += _solutionEvents_AfterClosing; this._solutionEvents.BeforeClosing += _solutionEvents_BeforeClosing; this._solutionEvents.Opened += _solutionEvents_Opened; this._solutionEvents.ProjectAdded += _solutionEvents_ProjectAdded; this._solutionEvents.ProjectRemoved += _solutionEvents_ProjectRemoved; this._solutionEvents.ProjectRenamed += _solutionEvents_ProjectRenamed; this._solutionEvents.QueryCloseSolution += _solutionEvents_QueryCloseSolution; this._solutionEvents.Renamed += _solutionEvents_Renamed; // Project Events this._projectEvents = events2.ProjectsEvents; this._projectEvents.ItemAdded += _projectEvents_ItemAdded; this._projectEvents.ItemRemoved += _projectEvents_ItemRemoved; this._projectEvents.ItemRenamed += _projectEvents_ItemRenamed; // Project Item Events this._projectItemEvents = events2.ProjectItemsEvents; this._projectItemEvents.ItemAdded += ProjectItemsEvents_ItemAdded; this._projectItemEvents.ItemRemoved += _projectItemEvents_ItemRemoved; this._projectItemEvents.ItemRenamed += _projectItemEvents_ItemRenamed; // Command Events this._commandEvents = events2.CommandEvents; this._commandEvents.BeforeExecute += _commandEvents_BeforeExecute; this._commandEvents.AfterExecute += _commandEvents_AfterExecute; }
/// <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; _addIn = (EnvDTE.AddIn)addInInst; // Events _events = (Events2)_application.Events; _projectsEvents = _events.ProjectsEvents; _projectItemsEvents = _events.ProjectItemsEvents; _documentEvents = _events.DocumentEvents; _buildEvents = _events.BuildEvents; AttachEvents(); _core = new Core(); // If being connected when Solution is already loaded - try to load all projects if (_application.Solution != null) { _core.Load(_application.Solution); } }