_dispSolutionEvents_BeforeClosingEventHandler-Delegat

Diese API unterstützt die .NET Framework-Infrastruktur und ist nicht für die direkte Verwendung in Code bestimmt.

Behandelt Ereignisse, die vor dem Schließen einer Projektmappe ausgelöst werden.

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

Syntax

'Declaration
<ComVisibleAttribute(False)> _
Public Delegate Sub _dispSolutionEvents_BeforeClosingEventHandler
[ComVisibleAttribute(false)]
public delegate void _dispSolutionEvents_BeforeClosingEventHandler()
[ComVisibleAttribute(false)]
public delegate void _dispSolutionEvents_BeforeClosingEventHandler()
[<ComVisibleAttribute(false)>]
type _dispSolutionEvents_BeforeClosingEventHandler = 
    delegate of unit -> unit
JScript unterstützt keine Delegaten.

Hinweise

Das SolutionEvents-Objekt kann den Bereich verlassen und wird der Garbage Collection unterzogen, bevor die Projektmappe geschlossen wird.Um einen Verweis auf dieses Objekt beizubehalten, deklarieren Sie eine private Variable in der Klasse, in der Sie die Projektmappenereignishandler implementieren.

Beispiele

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

Siehe auch

Referenz

EnvDTE-Namespace