Compartilhar via


Delegado _dispSolutionEvents_BeforeClosingEventHandler

Esta API oferece suporte à infraestrutura .NET Framework e não se destina a ser usada diretamente do seu código.

Trata os eventos que são acionados antes de uma solução é fechada.

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

Sintaxe

'Declaração
<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 não oferece suporte a delegados.

Comentários

O SolutionEvents objeto pode ir fora do escopo e ser lixo coletado antes que a solução é fechada.Para manter uma referência a esse objeto, declare uma variável private na classe em que você implemente os manipuladores de eventos de solução.

Exemplos

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

Consulte também

Referência

Namespace EnvDTE