Exemplo n.º 1
0
 /// <summary>
 /// Waits for corresponding begin operation to complete.
 /// </summary>
 /// <param name="asyncResult">Async result from the corresponding begin method.</param>
 public void EndEstablishConversationAndImCall(IAsyncResult asyncResult)
 {
     if (asyncResult == null)
     {
         throw new ArgumentException(ExceptionResource.InvalidAsyncResult);
     }
     else
     {
         EstablishConversationAndImCallAsyncResult establishAsyncResult = asyncResult as EstablishConversationAndImCallAsyncResult;
         if (establishAsyncResult == null)
         {
             throw new ArgumentException(ExceptionResource.InvalidAsyncResult);
         }
         else
         {
             establishAsyncResult.EndInvoke();
         }
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Establish
        /// </summary>
        /// <param name="destinationQueue">Destination queue. Cannot be null or empty.</param>
        /// <param name="callback">Callback method.</param>
        /// <param name="state">User state.</param>
        /// <returns>Async result reference.</returns>
        public IAsyncResult BeginEstablishConversationAndImCall(string destinationQueue, string productId, AsyncCallback callback, object state)
        {
            Dictionary <string, string> convContext = null;

            lock (m_syncRoot)
            {
                if (!this.TryUpdateState(ConversationModelState.Establishing))
                {
                    throw new InvalidOperationException(ExceptionResource.InvalidState);
                }
                else
                {
                    if (!String.IsNullOrEmpty(productId))
                    {
                        convContext = ConversationModel.GetContextFromProductId(productId);
                    }
                    this.RegisterServiceEventHandlers();
                    EstablishConversationAndImCallAsyncResult asyncResult = new EstablishConversationAndImCallAsyncResult(this, destinationQueue, convContext, callback, state);
                    asyncResult.Process();
                    return(asyncResult);
                }
            }
        }