Partilhar via


Método IVsContainedLanguageStaticEventBinding.EnsureStaticEventHandler

Cria um manipulador de eventos recebe o contexto de classe, o nome da instância e tipo de objeto, o nome do evento e o nome (exclusivo) do manipulador de eventos.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop.8.0 (em Microsoft.VisualStudio.TextManager.Interop.8.0.dll)

Sintaxe

'Declaração
Function EnsureStaticEventHandler ( _
    pszClassName As String, _
    pszObjectTypeName As String, _
    pszObjectName As String, _
    pszNameOfEvent As String, _
    pszEventHandlerName As String, _
    itemidInsertionPoint As UInteger, _
    <OutAttribute> ByRef pbstrUniqueMemberID As String, _
    <OutAttribute> ByRef pbstrEventBody As String, _
    <OutAttribute> pSpanInsertionPoint As TextSpan() _
) As Integer
int EnsureStaticEventHandler(
    string pszClassName,
    string pszObjectTypeName,
    string pszObjectName,
    string pszNameOfEvent,
    string pszEventHandlerName,
    uint itemidInsertionPoint,
    out string pbstrUniqueMemberID,
    out string pbstrEventBody,
    TextSpan[] pSpanInsertionPoint
)
int EnsureStaticEventHandler(
    [InAttribute] String^ pszClassName, 
    [InAttribute] String^ pszObjectTypeName, 
    [InAttribute] String^ pszObjectName, 
    [InAttribute] String^ pszNameOfEvent, 
    [InAttribute] String^ pszEventHandlerName, 
    [InAttribute] unsigned int itemidInsertionPoint, 
    [OutAttribute] String^% pbstrUniqueMemberID, 
    [OutAttribute] String^% pbstrEventBody, 
    [OutAttribute] array<TextSpan>^ pSpanInsertionPoint
)
abstract EnsureStaticEventHandler : 
        pszClassName:string * 
        pszObjectTypeName:string * 
        pszObjectName:string * 
        pszNameOfEvent:string * 
        pszEventHandlerName:string * 
        itemidInsertionPoint:uint32 * 
        pbstrUniqueMemberID:string byref * 
        pbstrEventBody:string byref * 
        pSpanInsertionPoint:TextSpan[] byref -> int
function EnsureStaticEventHandler(
    pszClassName : String, 
    pszObjectTypeName : String, 
    pszObjectName : String, 
    pszNameOfEvent : String, 
    pszEventHandlerName : String, 
    itemidInsertionPoint : uint, 
    pbstrUniqueMemberID : String, 
    pbstrEventBody : String, 
    pSpanInsertionPoint : TextSpan[]
) : int

Parâmetros

  • pszClassName
    Tipo: String

    [in] O nome totalmente qualificado da classe.

  • pszObjectTypeName
    Tipo: String

    [in] O nome totalmente qualificado do tipo de objeto.

  • pszObjectName
    Tipo: String

    [in] O nome do objeto.

  • pszNameOfEvent
    Tipo: String

    [in] O nome do evento.

  • pszEventHandlerName
    Tipo: String

    [in] O nome do manipulador de eventos.

  • pbstrUniqueMemberID
    Tipo: String%

    [out] Retorna um string que contém a identificação de membro do evento. Retorna um valor nulo se o manipulador de eventos já existe.

  • pbstrEventBody
    Tipo: String%

    [out] Retorna um string que contém o corpo do manipulador de eventos. Retorna um valor nulo se o manipulador de eventos já existe.

  • pSpanInsertionPoint
    Tipo: array<Microsoft.VisualStudio.TextManager.Interop.TextSpan[]

    [in, out] Preenche uma TextSpan o objeto com a posição onde o corpo do manipulador de eventos foi inserido no buffer principal. Este ponto de inserção está no arquivo especificado pelo itemidInsertionPoint parâmetro. Isso é válido somente se o manipulador de eventos já não existe.

Valor de retorno

Tipo: Int32
Se bem-sucedida, retorna S_OK; Caso contrário, retorna um código de erro.

Comentários

COM assinatura

De singlefileeditor.idl:

HRESULT EnsureStaticEventHandler(
   [in]  LPCWSTR   pszClassName,
   [in]  LPCWSTR   pszObjectTypeName,
   [in]  LPCWSTR   pszObjectName,
   [in]  LPCWSTR   pszNameOfEvent,
   [in]  LPCWSTR   pszEventHandlerName,
   [in]  VSITEMID  itemidInsertionPoint,
   [out] BSTR*     pbstrUniqueMemberID,
   [out] BSTR*     pbstrEventBody,
   [out] TextSpan* pSpanInsertionPoint
);

Se o manipulador de eventos já existe, esse método retorna S_OK e o pbstrEventBody e pbstrUniqueMemberID parâmetros retornam valores nulos e o pSpanInsertionPoint parâmetro é indefinido.

Observe que esse método não injetar o manipulador de eventos gerados buffer secundário ou arquivo de classe parcial, somente no buffer principal.

Segurança do .NET Framework

Consulte também

Referência

IVsContainedLanguageStaticEventBinding Interface

Namespace Microsoft.VisualStudio.TextManager.Interop