示例#1
0
 /// <summary>
 /// Waits for corresponding begin operation to complete.
 /// </summary>
 /// <param name="asyncResult">Async result from the corresponding begin method.</param>
 public void EndEstablishConversation(IAsyncResult asyncResult)
 {
     if (asyncResult == null)
     {
         throw new ArgumentException(ExceptionResource.InvalidAsyncResult);
     }
     else
     {
         EstablishConversationAsyncResult establishAsyncResult = asyncResult as EstablishConversationAsyncResult;
         if (establishAsyncResult == null)
         {
             throw new ArgumentException(ExceptionResource.InvalidAsyncResult);
         }
         else
         {
             establishAsyncResult.EndInvoke();
         }
     }
 }
示例#2
0
        /// <summary>
        /// Initiates a new conversation with the contact center service.
        /// </summary>
        /// <param name="destinationQueue">Destination queue. Cannot be null or empty.</param>
        /// <param name="localParticipant">Local participant name. Can be null or empty.</param>
        /// <param name="subject">Subject of the conversation. Can be null or empty.</param>
        /// <param name="productId">Product Id context. Can be null or empty.</param>
        /// <param name="callback">Callback method.</param>
        /// <param name="state">User state.</param>
        /// <returns>Async result reference.</returns>
        public IAsyncResult BeginEstablishConversation(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();
                    EstablishConversationAsyncResult asyncResult = new EstablishConversationAsyncResult(this, convContext, callback, state);
                    asyncResult.Process();
                    return(asyncResult);
                }
            }
        }