protected override bool ExecuteRemoveParty(Party partyToRemove, bool isUser) { if (isUser) { return(UserParties.Remove(partyToRemove)); } return(BotParties.Remove(partyToRemove)); }
public override void DeleteAll() { base.DeleteAll(); AggregationParties.Clear(); UserParties.Clear(); BotParties.Clear(); PendingRequests.Clear(); ConnectedParties.Clear(); }
public virtual void DeleteAll() { AggregationParties.Clear(); UserParties.Clear(); BotParties.Clear(); PendingRequests.Clear(); ConnectedParties.Clear(); #if DEBUG LastMessageRouterResults.Clear(); #endif }
protected override bool ExecuteAddParty(Party partyToAdd, bool isUser) { if (isUser) { UserParties.Add(partyToAdd); } else { BotParties.Add(partyToAdd); } return(true); }
public virtual Party FindBotPartyByChannelAndConversation(string channelId, ConversationAccount conversationAccount) { Party botParty = null; try { botParty = BotParties.Single(party => (party.ChannelId.Equals(channelId) && party.ConversationAccount.Id.Equals(conversationAccount.Id))); } catch (InvalidOperationException) { } return(botParty); }
public virtual bool AddParty(Party newParty, bool isUser = true) { if (newParty == null || (isUser ? UserParties.Contains(newParty) : BotParties.Contains(newParty))) { return(false); } if (isUser) { UserParties.Add(newParty); } else { if (newParty.ChannelAccount == null) { throw new NullReferenceException($"Channel account of a bot party ({nameof(newParty.ChannelAccount)}) cannot be null"); } BotParties.Add(newParty); } return(true); }