C# Class Sanford.Threading.DelegateQueue

Represents an asynchronous queue of delegates.
Inheritance: System.Threading.SynchronizationContext, IComponent, ISynchronizeInvoke
Afficher le fichier Open project: hmadrigal/playground-dotnet Class Usage Examples

Méthodes publiques

Méthode Description
BeginInvoke ( Delegate method ) : IAsyncResult

Executes the delegate on the main thread that this DelegateQueue executes on.

The delegate is called asynchronously, and this method returns immediately. You can call this method from any thread. If you need the return value from a process started with this method, call EndInvoke to get the value.

If you need to call the delegate synchronously, use the Invoke method instead.

DelegateQueue ( string name ) : System

Initializes a new instance of the DelegateQueue class.

DelegateQueue ( string name, IContainer container ) : System

Initializes a new instance of the DelegateQueue class with the specified IContainer object.

Dispose ( ) : void

Disposes of the DelegateQueue.

EndInvoke ( IAsyncResult result ) : object

Waits until the process started by calling BeginInvoke completes, and then returns the value generated by the process.

This method gets the return value of the asynchronous operation represented by the IAsyncResult passed by this interface. If the asynchronous operation has not completed, this method will wait until the result is available.

Invoke ( Delegate method ) : object

Executes the delegate on the main thread that this DelegateQueue executes on.

Unlike BeginInvoke, this method operates synchronously, that is, it waits until the process completes before returning. Exceptions raised during the call are propagated back to the caller.

Use this method when calling a method from a different thread to marshal the call to the proper thread.

Post ( SendOrPostCallback d, object state ) : void

Dispatches an asynchronous message to this synchronization context.

The Post method starts an asynchronous request to post a message.

Send ( SendOrPostCallback d, object state ) : void

Dispatches a synchronous message to this synchronization context.

The Send method starts an synchronous request to send a message.

Méthodes protégées

Méthode Description
Dispose ( bool disposing ) : void
OnDisposed ( EventArgs e ) : void
OnInvokeCompleted ( InvokeCompletedEventArgs e ) : void
OnPostCompleted ( Sanford.Threading.PostCompletedEventArgs e ) : void

Private Methods

Méthode Description
DelegateProcedure ( ) : void
InitializeDelegateQueue ( string name ) : void

Method Details

BeginInvoke() public méthode

Executes the delegate on the main thread that this DelegateQueue executes on.

The delegate is called asynchronously, and this method returns immediately. You can call this method from any thread. If you need the return value from a process started with this method, call EndInvoke to get the value.

If you need to call the delegate synchronously, use the Invoke method instead.

public BeginInvoke ( Delegate method ) : IAsyncResult
method System.Delegate /// A Delegate to a method that takes parameters of the same number and type that /// are contained in args. ///
Résultat IAsyncResult

DelegateQueue() public méthode

Initializes a new instance of the DelegateQueue class.
public DelegateQueue ( string name ) : System
name string
Résultat System

DelegateQueue() public méthode

Initializes a new instance of the DelegateQueue class with the specified IContainer object.
public DelegateQueue ( string name, IContainer container ) : System
name string
container IContainer /// The IContainer to which the DelegateQueue will add itself. ///
Résultat System

Dispose() public méthode

Disposes of the DelegateQueue.
public Dispose ( ) : void
Résultat void

Dispose() protected méthode

protected Dispose ( bool disposing ) : void
disposing bool
Résultat void

EndInvoke() public méthode

Waits until the process started by calling BeginInvoke completes, and then returns the value generated by the process.
This method gets the return value of the asynchronous operation represented by the IAsyncResult passed by this interface. If the asynchronous operation has not completed, this method will wait until the result is available.
public EndInvoke ( IAsyncResult result ) : object
result IAsyncResult /// An IAsyncResult interface that represents the asynchronous operation started /// by calling BeginInvoke. ///
Résultat object

Invoke() public méthode

Executes the delegate on the main thread that this DelegateQueue executes on.

Unlike BeginInvoke, this method operates synchronously, that is, it waits until the process completes before returning. Exceptions raised during the call are propagated back to the caller.

Use this method when calling a method from a different thread to marshal the call to the proper thread.

public Invoke ( Delegate method ) : object
method System.Delegate /// A Delegate that contains a method to call, in the context of the thread for the DelegateQueue. ///
Résultat object

OnDisposed() protected méthode

protected OnDisposed ( EventArgs e ) : void
e System.EventArgs
Résultat void

OnInvokeCompleted() protected méthode

protected OnInvokeCompleted ( InvokeCompletedEventArgs e ) : void
e InvokeCompletedEventArgs
Résultat void

OnPostCompleted() protected méthode

protected OnPostCompleted ( Sanford.Threading.PostCompletedEventArgs e ) : void
e Sanford.Threading.PostCompletedEventArgs
Résultat void

Post() public méthode

Dispatches an asynchronous message to this synchronization context.
The Post method starts an asynchronous request to post a message.
public Post ( SendOrPostCallback d, object state ) : void
d SendOrPostCallback /// The SendOrPostCallback delegate to call. ///
state object /// The object passed to the delegate. ///
Résultat void

Send() public méthode

Dispatches a synchronous message to this synchronization context.
The Send method starts an synchronous request to send a message.
public Send ( SendOrPostCallback d, object state ) : void
d SendOrPostCallback /// The SendOrPostCallback delegate to call. ///
state object /// The object passed to the delegate. ///
Résultat void