예제 #1
0
        public IResourceList GetThreadChildren(IResource res)
        {
            IResourceThreadingHandler handler = GetResourceThreadingHandler(res);

            if (handler != null)
            {
                return(handler.GetThreadChildren(res));
            }
            return(Core.ResourceStore.EmptyResourceList);
        }
예제 #2
0
        private static IResourceList UnrollConversationRecursive(IResourceList conv, IResource res,
                                                                 IResourceThreadingHandler handler)
        {
            IResourceList replies = handler.GetThreadChildren(res);

            conv = replies.Union(conv);
            foreach (IResource replyRes in replies)
            {
                conv = UnrollConversationRecursive(conv, replyRes, handler);
            }
            return(conv);
        }
예제 #3
0
        protected override void HandleResourceAdded(object sender, ResourceIndexEventArgs e)
        {
            if (_disposed)
            {
                return;
            }

            lock ( _resourceList )
            {
                ConversationNode newNode = GetConversationNode(e.Resource);
                newNode.InList = true;

                foreach (IResource child in _threadingHandler.GetThreadChildren(e.Resource))
                {
                    ConversationNode childNode = FindConversationNode(child.Id);
                    if (childNode != null && !newNode.HasChild(childNode))
                    {
                        newNode.AddChild(childNode);
                    }
                }

                if (_threadingHandler.GetThreadParent(e.Resource) == null)
                {
                    OnThreadRootAdded(e.Resource, newNode);
                }
                else
                {
                    // if the parent is not in list, the node should be added as a root (#6376)
                    if (!OnThreadChildAdded(e.Resource, newNode))
                    {
                        OnThreadRootAdded(e.Resource, newNode);
                    }
                }
            }


            OnResourceCountChanged();
        }