Exemplo n.º 1
0
 /// <summary>
 /// Implementation of asynchronous function called by sub-classes with appropriate action and function parameters
 /// to perform the asynchronous operation, and turn results into TEventArgs.
 /// This override just defaults the userState object to null.
 /// </summary>
 /// <typeparam name="TData">Input data type of operation.</typeparam>
 /// <param name="data">Operation input data.</param>
 /// <param name="operation">Operation being called in another thread by AsyncOperation.</param>
 /// <param name="actionProxy">Action being called.</param>
 /// <param name="funcEvent">Function to create TEventArgs from results.</param>
 public void AsyncActionImpl <TData>(TData data
                                     , AsyncOperationActionDefaultDelegate <TData> operation
                                     , Action <TData> actionProxy
                                     , MakeActionEventDelegate <TData> funcEvent)
 {
     this.AsyncActionImpl(null, data, operation, actionProxy, funcEvent);
 }
Exemplo n.º 2
0
    // Implementation defined in sub-class.

    /// <summary>
    /// Implementation of asynchronous function called by sub-classes with appropriate action and function parameters
    /// to perform the asynchronous operation, and turn results into TEventArgs.
    /// </summary>
    /// <typeparam name="TData">Input data type of operation.</typeparam>
    /// <param name="userState">User state object provided by calling code.</param>
    /// <param name="data">Operation input data.</param>
    /// <param name="operation">Operation being called in another thread by AsyncOperation.</param>
    /// <param name="actionProxy">Action being called.</param>
    /// <param name="funcEvent">Function to create TEventArgs from results.</param>
    public void AsyncActionImpl <TData>(object userState
                                        , TData data
                                        , AsyncOperationActionDefaultDelegate <TData> operation
                                        , Action <TData> actionProxy
                                        , MakeActionEventDelegate <TData> funcEvent
                                        )
    {
        AsyncOperation        asyncOp    = this.CreateOperation(userState);
        DataAndAction <TData> dataaction = new DataAndAction <TData>
        {
            operation = operation,
            data      = data,
            action    = actionProxy,
            funcEvent = funcEvent
        };
        AsyncOperationActionDelegate <TData> asyncDelegate = this.AsyncOperationAction <TData>;

        asyncDelegate.BeginInvoke(dataaction, asyncOp, null, null);
    }