Exemplo n.º 1
0
        /// <summary>
        /// Method called for handling asychronous operation completion. This is the method that the underlying, free-threaded aysnchronous behavior will invoke. This will happen on an arbitrary thread.
        /// </summary>
        /// <param name="map">A picture of the level map.</param>
        /// <param name="exception">Any exceptions that had occured while the operation was operating.</param>
        /// <param name="canceled">A value indicating whether the opreation was canceled by the user.</param>
        /// <param name="asyncOp">The asynchronous operation.</param>
        private void CompletionMethod(Bitmap map, Exception exception, bool canceled, AsyncOperation asyncOp)
        {
            CompletedEventArgs e = new CompletedEventArgs(exception, canceled, asyncOp.UserSuppliedState)
            {
                Result = map
            };

            // Let the asyncOp marshall the call for completion.
            this.busy = false;
            asyncOp.PostOperationCompleted(this.onCompletedDelegate, e);
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method is invoked via the AsyncOperation object, so it is guaranteed to be executed on the correct thread.
        /// </summary>
        /// <param name="operationState">The state of the operation.</param>
        private void ConverterCompleted(object operationState)
        {
            CompletedEventArgs e = (CompletedEventArgs)operationState;

            this.OnCompleted(e);
        }