Пример #1
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();
        }