DesignerTransactionCloseEventHandler Delegat

Definicja

Reprezentuje metodę, która obsługuje TransactionClosed zdarzenia i TransactionClosing projektanta.

C#
public delegate void DesignerTransactionCloseEventHandler(object sender, DesignerTransactionCloseEventArgs e);
C#
public delegate void DesignerTransactionCloseEventHandler(object? sender, DesignerTransactionCloseEventArgs e);
C#
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void DesignerTransactionCloseEventHandler(object sender, DesignerTransactionCloseEventArgs e);

Parametry

sender
Object

Źródło zdarzenia.

Atrybuty

Przykłady

W poniższym przykładzie pokazano rejestrowanie i DesignerTransactionCloseEventHandler obsługę zdarzeń TransactionClosing i TransactionClosed .

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

Uwagi

Podczas tworzenia delegata należy zidentyfikować metodę DesignerTransactionCloseEventHandler , która będzie obsługiwać zdarzenie. Aby skojarzyć zdarzenie z programem obsługi zdarzeń, dodaj wystąpienie delegata do zdarzenia. Program obsługi zdarzeń jest wywoływany przy każdym wystąpieniu zdarzenia, o ile nie usunięto delegata. Aby uzyskać więcej informacji na temat delegatów programu obsługi zdarzeń, zobacz Obsługa i podnoszenie zdarzeń.

Metody rozszerzania

GetMethodInfo(Delegate)

Pobiera obiekt reprezentujący metodę reprezentowaną przez określonego delegata.

Dotyczy

Produkt Wersje
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

Zobacz też