Exemple #1
0
        private static void ThreadMessage(this AgentMessage messageToThread, AgentMessage messageToThreadFrom)
        {
            ThreadDecorator previousMessageThreadContext = null;

            try
            {
                previousMessageThreadContext = messageToThreadFrom.GetDecorator <ThreadDecorator>(DecoratorIdentifier);
            }
            catch (AriesFrameworkException) { }

            ThreadDecorator currentThreadContext;

            if (previousMessageThreadContext != null)
            {
                currentThreadContext = new ThreadDecorator
                {
                    ParentThreadId = previousMessageThreadContext.ParentThreadId,
                    ThreadId       = previousMessageThreadContext.ThreadId
                };
            }
            else
            {
                currentThreadContext = new ThreadDecorator
                {
                    ThreadId = messageToThreadFrom.Id
                };
            }


            messageToThread.AddDecorator(currentThreadContext, DecoratorIdentifier);
        }
Exemple #2
0
        /// <summary>
        /// Threads the current message.
        /// </summary>
        /// <param name="messageToThread">Message to thread.</param>
        /// <param name="threadId">Thread id to thread the message with.</param>
        public static void ThreadFrom(this AgentMessage messageToThread, string threadId)
        {
            var currentThreadContext = new ThreadDecorator
            {
                ThreadId = threadId
            };

            messageToThread.AddDecorator(currentThreadContext, DecoratorIdentifier);
        }