다음을 통해 공유


IVsaCodeItem.AddEventSource 메서드

코드 항목에 이벤트 소스를 추가합니다.코드 항목은 호스트가 구현하는 IVsaSite.GetEventSourceInstance 메서드를 호출하여 명명된 이벤트 소스에 이벤트를 후크하는 데 이벤트 소스를 사용합니다.

네임스페이스:  Microsoft.Vsa
어셈블리:  Microsoft.Vsa(Microsoft.Vsa.dll)

구문

‘선언
<PermissionSetAttribute(SecurityAction.LinkDemand, Name := "FullTrust")> _
Sub AddEventSource ( _
    eventSourceName As String, _
    eventSourceType As String _
)
[PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")]
void AddEventSource(
    string eventSourceName,
    string eventSourceType
)
[PermissionSetAttribute(SecurityAction::LinkDemand, Name = L"FullTrust")]
void AddEventSource(
    String^ eventSourceName, 
    String^ eventSourceType
)
[<PermissionSetAttribute(SecurityAction.LinkDemand, Name = "FullTrust")>]
abstract AddEventSource : 
        eventSourceName:string * 
        eventSourceType:string -> unit 
function AddEventSource(
    eventSourceName : String, 
    eventSourceType : String
)

매개 변수

  • eventSourceName
    형식: System.String
    이벤트 소스의 프로그래밍 이름입니다.
  • eventSourceType
    형식: System.String
    이벤트 소스의 형식 이름입니다.

설명

스크립트 엔진은 AddEventSource 메서드가 제공 하는 정보를 사용 하 여 명명 된 이벤트 소스에 이벤트를 후크 하.호스트에서 구현 하는 IVsaSite.GetEventSourceInstance 메서드를 호출 하 여 이벤트 소스를 가져옵니다.AddEventSource 메서드는 호스트 제공 개체에서 발생 시킨 이벤트를 처리 하는 클래스를 만듭니다.

[!참고]

JScript입니다.NET 스크립트 엔진이이 메서드를 지원 하지 않습니다.경우에 위치는 JScript입니다.NET 엔진이 이벤트를 후크 해야 하 고 전역 항목을 사용 하 여 수행 해야 합니다.이벤트 소스 보다는 JScript입니다.NET 엔진 AppGlobal 항목 형식을 사용합니다.자세한 내용은 Vsaitemtype을 참조 하십시오.

코드 항목에 이벤트 소스 개체를 이름으로 액세스할 수 있습니다 및 액세스 한 개체에 대해 이벤트 처리기를 작성할 수 있습니다.이벤트 소스 형식은 관리 되지 않는 호스트에 의해 구현 된 이벤트 소스를 쉽게 하기 위해 Type 개체 대신 문자열로 전달 됩니다.

컴파일러는 eventSourceType 매개 변수 형식에서 제공 하는 메서드에 바인딩할 수 사용 합니다.스크립트 엔진 형식 개체의 인스턴스를 요청 하는 IVsaSite.GetEventSourceInstance 메서드를 호출 하는 경우 또한 나중에 사용 됩니다.

스크립트 엔진에 대 한 이벤트를 연결 하는 메커니즘에 대 한 자세한 내용은 IVsaSite.GetEventSourceInstance 메서드를 참조 하십시오.

참고 항목

참조

IVsaCodeItem 인터페이스

Microsoft.Vsa 네임스페이스