Udostępnij za pośrednictwem


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)

Syntax

'Declaration
<GuidAttribute("BF8BBF37-5415-46A9-940D-594CAD9DEC26")> _
Public Interface SolutionEvents _
    Inherits _SolutionEvents, _dispSolutionEvents_Event
[GuidAttribute("BF8BBF37-5415-46A9-940D-594CAD9DEC26")]
public interface SolutionEvents : _SolutionEvents, 
    _dispSolutionEvents_Event
[GuidAttribute(L"BF8BBF37-5415-46A9-940D-594CAD9DEC26")]
public interface class SolutionEvents : _SolutionEvents, 
    _dispSolutionEvents_Event
[<GuidAttribute("BF8BBF37-5415-46A9-940D-594CAD9DEC26")>]
type SolutionEvents =  
    interface
        interface _SolutionEvents
        interface _dispSolutionEvents_Event
    end
public interface SolutionEvents extends _SolutionEvents, _dispSolutionEvents_Event

The SolutionEvents type exposes the following members.

Methods

  Name Description
Public method add_AfterClosing Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method add_BeforeClosing Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method add_Opened Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method add_ProjectAdded Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method add_ProjectRemoved Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method add_ProjectRenamed Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method add_QueryCloseSolution Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method add_Renamed Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method remove_AfterClosing Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method remove_BeforeClosing Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method remove_Opened Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method remove_ProjectAdded Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method remove_ProjectRemoved Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method remove_ProjectRenamed Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method remove_QueryCloseSolution Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public method remove_Renamed Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)

Top

Events

  Name Description
Public event AfterClosing Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public event BeforeClosing Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public event Opened Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public event ProjectAdded Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public event ProjectRemoved Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public event ProjectRenamed Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public event QueryCloseSolution Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)
Public event Renamed Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.)

Top

Remarks

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.

Examples

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");
    }
}

See Also

Reference

EnvDTE Namespace