Export (0) Print
Expand All

SolutionEvents Interface

Provides events for changes to a solution. Use this object for functionality and refer to SolutionEventsClass for this object's documentation.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

[GuidAttribute("BF8BBF37-5415-46A9-940D-594CAD9DEC26")]
public interface SolutionEvents : _SolutionEvents, 
	_dispSolutionEvents_Event

The SolutionEvents type exposes the following members.

  NameDescription
Public methodadd_AfterClosingInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodadd_BeforeClosingInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodadd_OpenedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodadd_ProjectAddedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodadd_ProjectRemovedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodadd_ProjectRenamedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodadd_QueryCloseSolutionInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodadd_RenamedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodremove_AfterClosingInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodremove_BeforeClosingInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodremove_OpenedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodremove_ProjectAddedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodremove_ProjectRemovedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodremove_ProjectRenamedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodremove_QueryCloseSolutionInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public methodremove_RenamedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Top

  NameDescription
Public eventAfterClosingInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public eventBeforeClosingInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public eventOpenedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public eventProjectAddedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public eventProjectRemovedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public eventProjectRenamedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public eventQueryCloseSolutionInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public eventRenamedInfrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Top

The SolutionEvents object can go out of scope and be garbage collected before the solution is closed. To retain a reference to this object, declare a private variable in the class in which you implement the solution event handlers.

public class Connect : IDTExtensibility2
{
    private SolutionEvents _solnEvents;

    public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
    {
        _applicationObject = (DTE2)application;
        _addInInstance = (AddIn)addInInst;

        _solnEvents = _applicationObject.Events.SolutionEvents;

        _solutionBeforeClosingEventHandler = new _dispSolutionEvents_BeforeClosingEventHandler(this.SolutionBeforeClosing);
        _solnEvents.BeforeClosing += _solutionBeforeClosingEventHandler;
    }

    private _dispSolutionEvents_BeforeClosingEventHandler _solutionBeforeClosingEventHandler

    private void SolutionBeforeClosing()
    {
        System.Windows.Forms.MessageBox.Show("SolutionBeforeClosing");
    }
}

Community Additions

ADD
Show:
© 2014 Microsoft