/// <summary> /// Removes the engagements of the given conversation owners. /// </summary> /// <param name="conversationOwnerParties">The conversation owners whose engagements to remove.</param> /// <returns>The number of engagements removed.</returns> protected virtual IList <MessageRouterResult> RemoveEngagements(IList <Party> conversationOwnerParties) { IList <MessageRouterResult> messageRouterResults = new List <MessageRouterResult>(); foreach (Party conversationOwnerParty in conversationOwnerParties) { EngagedParties.TryGetValue(conversationOwnerParty, out Party conversationClientParty); if (EngagedParties.Remove(conversationOwnerParty)) { if (conversationOwnerParty is EngageableParty) { (conversationOwnerParty as EngageableParty).ResetEngagementStartedTime(); } if (conversationClientParty is EngageableParty) { (conversationClientParty as EngageableParty).ResetEngagementStartedTime(); } messageRouterResults.Add(new MessageRouterResult() { Type = MessageRouterResultType.EngagementRemoved, ConversationOwnerParty = conversationOwnerParty, ConversationClientParty = conversationClientParty }); } } return(messageRouterResults); }
/// <summary> /// Removes the engagements of the given conversation owners. /// </summary> /// <param name="conversationOwnerParties">The conversation owners whose engagements to remove.</param> /// <returns>The number of engagements removed.</returns> protected virtual IList <MessageRouterResult> RemoveEngagements(IList <Party> conversationOwnerParties) { IList <MessageRouterResult> messageRouterResults = new List <MessageRouterResult>(); foreach (Party conversationOwnerParty in conversationOwnerParties) { Party conversationClientParty = null; EngagedParties.TryGetValue(conversationOwnerParty, out conversationClientParty); if (EngagedParties.Remove(conversationOwnerParty)) { messageRouterResults.Add(new MessageRouterResult() { Type = MessageRouterResultType.EngagementRemoved, ConversationOwnerParty = conversationOwnerParty, ConversationClientParty = conversationClientParty }); } } return(messageRouterResults); }