예제 #1
0
        public AsyncResultBase DoSomething(AsyncCallback callback)
        {
            var arb = new WcfChannelAsyncResult();

            arb.InnerResult = arb.Channel.BeginCreateSession(arb.OnOperationCompleted);

            return(arb);
        }
예제 #2
0
/// <summary>
/// The client side implementation of the Begin_NAME_ service contract.
/// </summary>
    public IAsyncResult Begin_NAME_(_NAME_Message request, AsyncCallback callback, object asyncState)
    {
        WcfChannelAsyncResult asyncResult = new WcfChannelAsyncResult(Channel, callback, asyncState);

        lock (asyncResult.Lock)
        {
            asyncResult.InnerResult = asyncResult.Channel.Begin_NAME_(request, asyncResult.OnOperationCompleted, null);
        }

        return(asyncResult);
    }
예제 #3
0
        /// <summary>
        /// The client side implementation of the BeginInvokeService service contract.
        /// </summary>
        public override IAsyncResult BeginInvokeService(InvokeServiceMessage request, AsyncCallback callback, object asyncState)
        {
            WcfChannelAsyncResult asyncResult = new WcfChannelAsyncResult(m_channel, callback, asyncState);

            lock (asyncResult.Lock)
            {
                asyncResult.InnerResult = asyncResult.Channel.BeginInvokeService(request, asyncResult.OnOperationCompleted, null);
            }

            return(asyncResult);
        }
예제 #4
0
/// <summary>
/// The client side implementation of the End_NAME_ service contract.
/// </summary>
    public _NAME_ResponseMessage End_NAME_(IAsyncResult result)
    {
        try
        {
            WcfChannelAsyncResult asyncResult = WcfChannelAsyncResult.WaitForComplete(result);
            return(asyncResult.Channel.End_NAME_(asyncResult.InnerResult));
        }
        catch (FaultException <ServiceFault> e)
        {
            throw HandleSoapFault(e);
        }
    }
예제 #5
0
            /// <summary>
            /// Checks for a valid IAsyncResult object and waits for the operation to complete.
            /// </summary>
            /// <param name="ar">The IAsyncResult object for the operation.</param>
            /// <returns>The oject that </returns>
            public static new WcfChannelAsyncResult WaitForComplete(IAsyncResult ar)
            {
                WcfChannelAsyncResult asyncResult = ar as WcfChannelAsyncResult;

                if (asyncResult == null)
                {
                    throw new ArgumentException("End called with an invalid IAsyncResult object.", nameof(ar));
                }

                if (!asyncResult.WaitForComplete())
                {
                    throw new ServiceResultException(StatusCodes.BadTimeout);
                }

                return(asyncResult);
            }
예제 #6
0
        /// <summary>
        /// The client side implementation of the EndInvokeService service contract.
        /// </summary>
        public override InvokeServiceResponseMessage EndInvokeService(IAsyncResult result)
        {
            WcfChannelAsyncResult asyncResult = WcfChannelAsyncResult.WaitForComplete(result);

            return(asyncResult.Channel.EndInvokeService(asyncResult.InnerResult));
        }