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 | |
---|---|---|
add_AfterClosing | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
add_BeforeClosing | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
add_Opened | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
add_ProjectAdded | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
add_ProjectRemoved | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
add_ProjectRenamed | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
add_QueryCloseSolution | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
add_Renamed | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
remove_AfterClosing | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
remove_BeforeClosing | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
remove_Opened | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
remove_ProjectAdded | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
remove_ProjectRemoved | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
remove_ProjectRenamed | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
remove_QueryCloseSolution | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
remove_Renamed | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) |
Top
Events
Name | Description | |
---|---|---|
AfterClosing | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
BeforeClosing | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
Opened | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
ProjectAdded | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
ProjectRemoved | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
ProjectRenamed | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_Event.) | |
QueryCloseSolution | Infrastructure. Microsoft Internal Use Only. (Inherited from _dispSolutionEvents_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");
}
}