Beispiel #1
0
        /// <summary>
        /// Disconnects all connections associated with the given conversation reference.
        /// </summary>
        /// <param name="conversationReference">The conversation reference connected in a conversation.</param>
        /// <returns>The results:
        /// - ConnectionResultType.Disconnected,
        /// - ConnectionResultType.Error (see the error message for more details).
        /// </returns>
        public virtual IList <ConnectionResult> Disconnect(ConversationReference conversationReference)
        {
            IList <ConnectionResult> disconnectResults = new List <ConnectionResult>();
            bool wasDisconnected = true;

            while (wasDisconnected)
            {
                wasDisconnected = false;
                Connection connection = RoutingDataManager.FindConnection(conversationReference);

                if (connection != null)
                {
                    ConnectionResult disconnectResult = RoutingDataManager.Disconnect(connection);
                    disconnectResults.Add(disconnectResult);

                    if (disconnectResult.Type == ConnectionResultType.Disconnected)
                    {
                        wasDisconnected = true;
                    }
                }
            }

            return(disconnectResults);
        }