示例#1
0
        protected override bool ExecuteRemoveParty(Party partyToRemove, bool isUser)
        {
            if (isUser)
            {
                return(UserParties.Remove(partyToRemove));
            }

            return(BotParties.Remove(partyToRemove));
        }
示例#2
0
        public override void DeleteAll()
        {
            base.DeleteAll();

            AggregationParties.Clear();
            UserParties.Clear();
            BotParties.Clear();
            PendingRequests.Clear();
            ConnectedParties.Clear();
        }
示例#3
0
        public virtual void DeleteAll()
        {
            AggregationParties.Clear();
            UserParties.Clear();
            BotParties.Clear();
            PendingRequests.Clear();
            ConnectedParties.Clear();
#if DEBUG
            LastMessageRouterResults.Clear();
#endif
        }
示例#4
0
        protected override bool ExecuteAddParty(Party partyToAdd, bool isUser)
        {
            if (isUser)
            {
                UserParties.Add(partyToAdd);
            }
            else
            {
                BotParties.Add(partyToAdd);
            }

            return(true);
        }
示例#5
0
        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);
        }
示例#6
0
        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);
        }