DesignerTransactionCloseEventHandler Delegált
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
A tervezők eseményeit és TransactionClosed eseményeit TransactionClosing kezelő metódust jelöli.
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)
Paraméterek
- sender
- Object
Az esemény forrása.
Az DesignerTransactionCloseEventArgs eseményadatokat tartalmazó A.
- Attribútumok
Példák
Az alábbi példa bemutatja a DesignerTransactionCloseEventHandler regisztrációt és az TransactionClosingTransactionClosed események kezelését.
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
Megjegyzések
Meghatalmazott létrehozásakor DesignerTransactionCloseEventHandler azonosítja az eseményt kezelő metódust. Az esemény eseménykezelőhöz való társításához adja hozzá a meghatalmazott egy példányát az eseményhez. Az eseménykezelőt mindig meghívja a rendszer, ha nem távolítja el a meghatalmazottat. Az eseménykezelő delegáltjaival kapcsolatos további információkért lásd: Események kezelése és emelése.
Bővítő metódusok
| Name | Description |
|---|---|
| GetMethodInfo(Delegate) |
Lekéri a megadott meghatalmazott által képviselt metódust képviselő objektumot. |