다음을 통해 공유


DesignerTransactionCloseEventHandler 대리자

정의

디자이너의 TransactionClosedTransactionClosing 이벤트를 처리할 메서드를 나타냅니다.

public delegate void DesignerTransactionCloseEventHandler(System::Object ^ sender, DesignerTransactionCloseEventArgs ^ e);
public delegate void DesignerTransactionCloseEventHandler(object sender, DesignerTransactionCloseEventArgs e);
public delegate void DesignerTransactionCloseEventHandler(object? sender, DesignerTransactionCloseEventArgs e);
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void DesignerTransactionCloseEventHandler(object sender, DesignerTransactionCloseEventArgs e);
type DesignerTransactionCloseEventHandler = delegate of obj * DesignerTransactionCloseEventArgs -> unit
[<System.Runtime.InteropServices.ComVisible(true)>]
type DesignerTransactionCloseEventHandler = delegate of obj * DesignerTransactionCloseEventArgs -> unit
Public Delegate Sub DesignerTransactionCloseEventHandler(sender As Object, e As DesignerTransactionCloseEventArgs)

매개 변수

sender
Object

이벤트 소스입니다.

e
DesignerTransactionCloseEventArgs

이벤트 데이터를 포함하는 DesignerTransactionCloseEventArgs입니다.

특성

예제

다음 예제에서는 등록 하 고 DesignerTransactionCloseEventHandler 처리는 TransactionClosingTransactionClosed 이벤트입니다.

public:
   void LinkDesignerTransactionCloseEvent( IDesignerHost^ host )
   {
      // Registers an event handler for the designer TransactionClosing and TransactionClosed events.
      host->TransactionClosing += gcnew DesignerTransactionCloseEventHandler(
         this, &DesignerTransactionCloseEventHandlerExample::OnTransactionClose );
      host->TransactionClosed += gcnew DesignerTransactionCloseEventHandler(
         this, &DesignerTransactionCloseEventHandlerExample::OnTransactionClose );
   }

private:
   void OnTransactionClose( Object^ sender, DesignerTransactionCloseEventArgs^ e )
   {
      // Displays transaction close information on the console.
      if ( e->TransactionCommitted )
      {
         Console::WriteLine( "Transaction has been committed." );
      }
      else
      {
         Console::WriteLine( "Transaction has not yet been committed." );
      }
   }
public void LinkDesignerTransactionCloseEvent(IDesignerHost host)
{                       
    // Registers an event handler for the designer TransactionClosing and TransactionClosed events.
    host.TransactionClosing += new DesignerTransactionCloseEventHandler(this.OnTransactionClose);
    host.TransactionClosed += new DesignerTransactionCloseEventHandler(this.OnTransactionClose);
}

private void OnTransactionClose(object sender, DesignerTransactionCloseEventArgs e)
{
    // Displays transaction close information on the console.           
    if( e.TransactionCommitted )            
        Console.WriteLine("Transaction has been committed.");
    else
        Console.WriteLine("Transaction has not yet been committed.");
}
Public Sub LinkDesignerTransactionCloseEvent(ByVal host As IDesignerHost)
    ' Registers an event handler for the designer TransactionClosing 
    ' and TransactionClosed events.
    AddHandler host.TransactionClosing, AddressOf Me.OnTransactionClose
    AddHandler host.TransactionClosed, AddressOf Me.OnTransactionClose
End Sub

Private Sub OnTransactionClose(ByVal sender As Object, ByVal e As DesignerTransactionCloseEventArgs)
    ' Displays transaction close information on the console.           
    If e.TransactionCommitted Then
        Console.WriteLine("Transaction has been committed.")
    Else
        Console.WriteLine("Transaction has not yet been committed.")
    End If
End Sub

설명

DesignerTransactionCloseEventHandler 대리자를 만들 때, 이벤트를 처리할 메서드를 식별합니다. 이벤트를 이벤트 처리기와 연결하려면 대리자의 인스턴스를 해당 이벤트에 추가합니다. 대리자를 제거하지 않는 경우 이벤트가 발생할 때마다 이벤트 처리기가 호출됩니다. 이벤트 처리기 대리자에 대 한 자세한 내용은 참조 하세요. 이벤트 처리 및 발생합니다.

확장 메서드

GetMethodInfo(Delegate)

지정된 대리자가 나타내는 메서드를 나타내는 개체를 가져옵니다.

적용 대상

추가 정보