DesignerTransactionCloseEventHandler 代理人
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
デザイナーの TransactionClosed イベントと TransactionClosing イベントを処理するメソッドを表します。
public delegate void DesignerTransactionCloseEventHandler(System::Object ^ sender, DesignerTransactionCloseEventArgs ^ e);
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void DesignerTransactionCloseEventHandler(object sender, DesignerTransactionCloseEventArgs e);
public delegate void DesignerTransactionCloseEventHandler(object sender, DesignerTransactionCloseEventArgs e);
[<System.Runtime.InteropServices.ComVisible(true)>]
type DesignerTransactionCloseEventHandler = delegate of obj * DesignerTransactionCloseEventArgs -> unit
type DesignerTransactionCloseEventHandler = delegate of obj * DesignerTransactionCloseEventArgs -> unit
Public Delegate Sub DesignerTransactionCloseEventHandler(sender As Object, e As DesignerTransactionCloseEventArgs)
パラメーター
- sender
- Object
イベントのソース。
イベント データを含む DesignerTransactionCloseEventArgs 。
- 属性
例
次の例では、 DesignerTransactionCloseEventHandler を登録し、 TransactionClosing イベントと 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
注釈
DesignerTransactionCloseEventHandler デリゲートを作成するときは、イベントを処理するメソッドを識別します。 イベントをイベント ハンドラーに関連付けるには、デリゲートのインスタンスをイベントに追加します。 デリゲートを削除しない限り、イベントが発生するたびにイベント ハンドラーが呼び出されます。 イベント ハンドラー デリゲートの詳細については、「イベントの 処理と発生」を参照してください。
拡張メソッド
| 名前 | 説明 |
|---|---|
| GetMethodInfo(Delegate) |
指定したデリゲートによって表されるメソッドを表すオブジェクトを取得します。 |