示例#1
0
        /// <summary>
        /// Ends a pending asynchronous message push.
        /// </summary>
        /// <param name="asyncResult">An IAsyncResult that stores state information and any user defined data for this asynchronous operation.</param>
        /// <remarks>
        /// <para>
        /// EndInvoke is a blocking method that completes the asynchronous message push request started in the BeginPushMessageToClients method.
        /// </para>
        /// <para>
        /// Before calling BeginPushMessageToClients, you can create a callback method that implements the AsyncCallback delegate. This callback method executes in a separate thread and is called by the system after BeginPushMessageToClients returns.
        /// The callback method must accept the IAsyncResult returned by the BeginPushMessageToClients method as a parameter.
        /// </para>
        /// <para>Within the callback method you can call the EndPushMessageToClients method to successfully complete the invocation attempt.</para>
        /// <para>The BeginPushMessageToClients enables to use the fire and forget pattern too (by not implementing an AsyncCallback delegate), however if the invocation fails the EndPushMessageToClients method is responsible to throw an appropriate exception.
        /// Implementing the callback and calling EndPushMessageToClients also allows early garbage collection of the internal objects used in the asynchronous call.</para>
        /// </remarks>
        public void EndPushMessageToClients(IAsyncResult asyncResult)
        {
            AsyncResultNoResult ar = asyncResult as AsyncResultNoResult;

            // Wait for operation to complete, then return result or throw exception
            ar.EndInvoke();
        }
示例#2
0
        public void EndConnect(IAsyncResult asyncResult)
        {
            AsyncResultNoResult ar2 = (AsyncResultNoResult)asyncResult;

            ar2.EndInvoke();
            Debug.Assert(m_arConnect == null, "NOT m_arConnect == null");
        }
示例#3
0
        /// <summary>
        /// Asynchronous version of Connect.
        /// </summary>
        /// <param name="asyncResult"></param>
        public void EndConnect(IAsyncResult asyncResult)
        {
            AsyncResultNoResult ar = asyncResult as AsyncResultNoResult;

            // Wait for operation to complete, then return result or throw exception
            if (ar != null)
            {
                ar.EndInvoke();
            }
        }
示例#4
0
        /// <summary>
        /// Wait for asynchronous project sharing to finish, then return it
        /// </summary>
        /// <param name="asyncResult">IAsyncResult from BeginShareProject</param>
        /// <seealso cref="BeginShareProject"/>
        public void EndShareProject(IAsyncResult asyncResult)
        {
            AsyncResultNoResult <Project, IEnumerable <string> > ar = (AsyncResultNoResult <Project, IEnumerable <string> >)asyncResult;

            ar.EndInvoke();
        }
示例#5
0
        public static void EndInvoke <T>(/*this*/ Action <T> dlgt, IAsyncResult ar)
        {
            AsyncResultNoResult ar2 = (AsyncResultNoResult)ar;

            ar2.EndInvoke();
        }