Esempio n. 1
0
        /// <summary>
        /// Transitions an <see cref="IAsyncResult"/> instance to a completed state.
        /// </summary>
        /// <param name="asyncResult">An asynchronous result that identifies an invocation.</param>
        /// <param name="operationType">The expected operation type.</param>
        /// <param name="cancel">Boolean indicating whether or not the operation has been canceled.</param>
        /// <returns>A <see cref="WebDomainClientAsyncResult&lt;TContract&gt;"/> reference.</returns>
        /// <exception cref="ArgumentNullException"> if <paramref name="asyncResult"/> is null.</exception>
        /// <exception cref="ArgumentException"> if <paramref name="asyncResult"/> is not of type <cref name="TAsyncResult"/>.</exception>
        /// <exception cref="InvalidOperationException"> if <paramref name="asyncResult"/> has been canceled.</exception>
        /// <exception cref="InvalidOperationException"> if <paramref name="asyncResult"/>'s End* method has already been invoked.</exception>
        /// <exception cref="InvalidOperationException"> if <paramref name="asyncResult"/> has not completed.</exception>
        private WebDomainClientAsyncResult <TContract> EndAsyncResult(IAsyncResult asyncResult, AsyncOperationType operationType, bool cancel)
        {
            WebDomainClientAsyncResult <TContract> wcfClientResult = asyncResult as WebDomainClientAsyncResult <TContract>;

            if ((wcfClientResult != null) && (!object.ReferenceEquals(this, wcfClientResult.DomainClient) || wcfClientResult.AsyncOperationType != operationType))
            {
                throw new ArgumentException(Resources.WrongAsyncResult, "asyncResult");
            }

            return(AsyncResultBase.EndAsyncOperation <WebDomainClientAsyncResult <TContract> >(asyncResult, cancel));
        }
Esempio n. 2
0
        /// <summary>
        /// Transitions an <see cref="IAsyncResult"/> instance to a completed state.
        /// </summary>
        /// <param name="asyncResult">An asynchronous result that identifies an invocation.</param>
        /// <param name="operationType">The expected operation type.</param>
        /// <param name="cancel">Boolean indicating whether or not the operation has been canceled.</param>
        /// <returns>A <see cref="DomainClientAsyncResult"/> reference.</returns>
        /// <exception cref="ArgumentNullException"> if <paramref name="asyncResult"/> is null.</exception>
        /// <exception cref="ArgumentException"> if <paramref name="asyncResult"/> is for another operation or was not created by this <see cref="DomainClient"/> instance.</exception>
        /// <exception cref="InvalidOperationException"> if <paramref name="asyncResult"/> has been canceled.</exception>
        /// <exception cref="InvalidOperationException"> if <paramref name="asyncResult"/>'s End* method has already been invoked.</exception>
        /// <exception cref="InvalidOperationException"> if <paramref name="asyncResult"/> has not completed.</exception>
        private DomainClientAsyncResult EndAsyncResult(IAsyncResult asyncResult, AsyncOperationType operationType, bool cancel)
        {
            DomainClientAsyncResult domainClientResult = asyncResult as DomainClientAsyncResult;

            if ((domainClientResult != null) && (!object.ReferenceEquals(this, domainClientResult.DomainClient) || domainClientResult.AsyncOperationType != operationType))
            {
                throw new ArgumentException(Resources.WrongAsyncResult, "asyncResult");
            }

            return(AsyncResultBase.EndAsyncOperation <DomainClientAsyncResult>(asyncResult, cancel));
        }
 /// <summary>
 /// Transitions an <see cref="IAsyncResult"/> instance to mark the operation as ended.
 /// </summary>
 /// <typeparam name="TAsyncResult">The <see cref="AsyncResultBase"/> type expected.</typeparam>
 /// <param name="asyncResult">The <see cref="IAsyncResult"/> to examine.</param>
 /// <returns>The <paramref name="asyncResult"/> cast as the <typeparamref name="TAsyncResult"/> type expected.</returns>
 /// <exception cref="ArgumentNullException"> if <paramref name="asyncResult"/> is null.</exception>
 /// <exception cref="ArgumentException"> if <paramref name="asyncResult"/> is not of type <typeparamref name="TAsyncResult"/>.</exception>
 /// <exception cref="InvalidOperationException"> if <paramref name="asyncResult"/> has been canceled.</exception>
 /// <exception cref="InvalidOperationException"> if <paramref name="asyncResult"/>'s End* method has already been invoked.</exception>
 public static TAsyncResult EndAsyncOperation <TAsyncResult>(IAsyncResult asyncResult) where TAsyncResult : AsyncResultBase
 {
     return(AsyncResultBase.EndAsyncOperation <TAsyncResult>(asyncResult, false));
 }