_dispSolutionEvents_BeforeClosingEventHandler, délégué

Cette API prend en charge l'infrastructure .NET Framework et n'est pas destinée à être utilisée directement à partir de votre code.

Gère les événements déclenchés avant la fermeture d'une solution.

Espace de noms :  EnvDTE
Assembly :  EnvDTE (dans EnvDTE.dll)

Syntaxe

'Déclaration
<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 ne prend pas en charge les délégués.

Notes

L'objet SolutionEvents peut être hors de portée et être récupéré par le garbage collector avant que la solution ne soit fermée. Pour conserver une référence à cet objet, déclarez une variable privée dans la classe dans laquelle vous implémentez les gestionnaires d'événements de la solution.

Exemples

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

Voir aussi

Référence

EnvDTE, espace de noms