/// <summary> /// Begin terminate method. /// </summary> /// <param name="terminationConversationRequest">Termination request.</param> /// <param name="asyncCallback">callback.</param> /// <param name="state">State.</param> /// <returns>IAsync result.</returns> public IAsyncResult BeginTerminate(TerminateConversationRequest terminationConversationRequest, AsyncCallback asyncCallback, object state) { //Create a new async result. TerminateConversationAsyncResult asyncResult = new TerminateConversationAsyncResult(terminationConversationRequest, this, asyncCallback, state); asyncResult.Process(); return(asyncResult); }
/// <summary> /// Initiates a termination of this conversation with the contact center service. /// </summary> /// <param name="callback">Callback method.</param> /// <param name="state">User state.</param> /// <returns>Async result reference.</returns> public IAsyncResult BeginTerminateConversation(AsyncCallback callback, object state) { lock (m_syncRoot) { this.TryUpdateState(ConversationModelState.Terminating); TerminateConversationAsyncResult asyncResult = new TerminateConversationAsyncResult(this, callback, state); asyncResult.Process(); return(asyncResult); } }
/// <summary> /// Waits for corresponding begin operation to complete. /// </summary> /// <param name="asyncResult">Async result from the corresponding begin method.</param> public void EndTerminateConversation(IAsyncResult asyncResult) { if (asyncResult == null) { throw new ArgumentException(ExceptionResource.InvalidAsyncResult); } else { TerminateConversationAsyncResult terminateAsyncResult = asyncResult as TerminateConversationAsyncResult; if (terminateAsyncResult == null) { throw new ArgumentException(ExceptionResource.InvalidAsyncResult); } else { terminateAsyncResult.EndInvoke(); } } }
/// <summary> /// End terminate method. /// </summary> /// <param name="asyncResult"></param> /// <returns></returns> public TerminateConversationResponse EndTerminate(IAsyncResult asyncResult) { TerminateConversationResponse response = null; if (asyncResult == null) { throw new ArgumentException(FailureStrings.GenericFailures.InvalidAsyncResult, "asyncResult"); } else { TerminateConversationAsyncResult terminateConversationAsyncResult = asyncResult as TerminateConversationAsyncResult; if (terminateConversationAsyncResult == null) { throw new ArgumentException(FailureStrings.GenericFailures.InvalidAsyncResult, "asyncResult"); } else { response = terminateConversationAsyncResult.EndInvoke(); } } return(response); }