DesignerTransactionCloseEventHandler Delegado
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Representa el método que controla los eventos TransactionClosed y TransactionClosing de un diseñador.
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)
Parámetros
- sender
- Object
Origen del evento.
Objeto DesignerTransactionCloseEventArgs que contiene los datos del evento.
- Atributos
Ejemplos
En el ejemplo siguiente se muestra cómo registrar y DesignerTransactionCloseEventHandler controlar los TransactionClosing eventos y TransactionClosed .
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
Comentarios
Cuando se crea un delegado DesignerTransactionCloseEventHandler, se identifica el método que controlará el evento. Para asociar el evento al controlador, se debe agregar una instancia del delegado al evento. Siempre que se produce el evento, se llama a su controlador, a menos que se quite el delegado. Para obtener más información sobre los delegados del controlador de eventos, vea Control y generación de eventos.
Métodos de extensión
GetMethodInfo(Delegate) |
Obtiene un objeto que representa el método representado por el delegado especificado. |