//-----------------------------------------------------------------------
        public void SetRootItem(DataItem item)
        {
            RootItems.Clear();
            RootItems.Add(item);
            m_storedRootItems.Add(item);
            GraphNodeItems.Clear();

            foreach (var i in Descendants)
            {
                i.DataModel = this;

                if (item is GraphNodeItem && !GraphNodeItems.Contains(item))
                {
                    if (!GraphNodeItems.Contains(item as GraphNodeItem))
                    {
                        GraphNodeItems.Add(item as GraphNodeItem);
                    }
                }
            }

            if (RootItems.Any(e => !(e is GraphNodeItem)))
            {
                ShowAsGraph     = false;
                ShowAsDataModel = true;
            }
            else
            {
                ShowAsGraph     = true;
                ShowAsDataModel = false;
            }

            RaisePropertyChangedEvent("ShowAsGraph");
            RaisePropertyChangedEvent("ShowAsDataModel");
        }
Example #2
0
 /// <summary>
 ///     Clears all content and the tree.
 /// </summary>
 public void Clear()
 {
     RootItems.Clear();
     _contentItems.Clear();
     _contentItemMap.Clear();
     _pendingItems.Clear();
 }
 public void Clear()
 {
     RootItems.Clear();
     _allDebugReceived = false;
     _contentItems.Clear();
     _contentItemMap.Clear();
     _pendingItems.Clear();
 }
Example #4
0
        public void Reset()
        {
            if (RootItems == null)
            {
                return;
            }

            RootItems.Clear();
        }
Example #5
0
 /// <summary>
 /// 清空所有行
 /// </summary>
 internal void ClearItems()
 {
     RootItems.Clear();
     if (_selectedRows.Count > 0)
     {
         _selectedRows.Clear();
     }
     if (_isLoaded)
     {
         _panel.OnRowsChanged();
     }
 }
        protected override void OnDestroy()
        {
            Application.RemoveMessageFilter(this);

            destroying = true;
            foreach (var item in RootItems.ToArray())
            {
                item.Dispose();
            }
            RootItems.Clear();

            base.OnDestroy();
        }
Example #7
0
        private void CreateRootItems()
        {
            foreach (var disposable in RootItems)
            {
                disposable.Dispose();
            }

            _uiDispatch.Do(() =>
            {
                RootItems.Clear();

                CreateContainedDirectories();
                CreateContainedFiles();
            });

            SearchFoundNoMatch = null;
            PropertyChanged.Raise(this, nameof(SearchFoundNoMatch));
        }
Example #8
0
        /// <summary>
        ///     Rebuilds the tree.
        /// </summary>
        void RebuildTree()
        {
            lock (_syncContext)
            {
                _isRebuildingTree = true;
            }

            RootItems.Clear();
            _contentItemMap.Clear();

            foreach (var content in _contentItems)
            {
                AddItemToTreeImpl(content);
            }

            lock (_syncContext)
            {
                _isRebuildingTree = false;
            }
        }
Example #9
0
        //-----------------------------------------------------------------------
        public void SetRootItem(DataItem item)
        {
            RootItems.Clear();
            RootItems.Add(item);
            m_storedRootItems.Add(item);
            GraphNodeItems.Clear();

            foreach (var i in Descendants)
            {
                i.DataModel = this;

                if (item is GraphNodeItem && !GraphNodeItems.Contains(item))
                {
                    if (!GraphNodeItems.Contains(item as GraphNodeItem))
                    {
                        GraphNodeItems.Add(item as GraphNodeItem);
                    }
                }
            }

            UpdateEditorType();
        }
Example #10
0
        //##############################################################################################################

        //-----------------------------------------------------------------------
        public void FocusItem(DataItem item)
        {
            if (item == m_proxyRootItem)
            {
                m_focusedItemsPath.Clear();
                RootItems.Clear();
                foreach (var child in m_storedRootItems)
                {
                    RootItems.Add(child);
                }
            }
            else if (RootItems.Contains(item))
            {
                return;
            }
            else
            {
                item.Focus();

                m_focusedItemsPath.Clear();

                DataItem current = null;
                if (item is GraphNodeItem)
                {
                    current = (item as GraphNodeItem).LinkParents.FirstOrDefault();
                }
                else
                {
                    current = item.Parent;
                }

                while (current != null)
                {
                    if (current is CollectionChildItem || current is GraphNodeItem || !(current.Parent is CollectionChildItem))
                    {
                        m_focusedItemsPath.Add(current);
                    }

                    if (current is GraphNodeItem)
                    {
                        current = (current as GraphNodeItem).LinkParents.FirstOrDefault();
                    }
                    else
                    {
                        current = current.Parent;
                    }
                }
                m_focusedItemsPath.Remove(m_focusedItemsPath.Last());
                m_focusedItemsPath.Add(m_proxyRootItem);

                for (int i = 0; i < m_focusedItemsPath.Count; i++)
                {
                    m_focusedItemsPath[i].ZIndex    = i;
                    m_focusedItemsPath[i].FirstItem = Visibility.Visible;
                }

                for (int i = 0; i < m_focusedItemsPath.Count; i++)
                {
                    m_focusedItemsPath.Move(m_focusedItemsPath.Count - 1, i);
                }

                m_focusedItemsPath[0].FirstItem = Visibility.Hidden;

                RootItems.Clear();
                RootItems.Add(item);
                item.IsExpanded = true;

                if (m_lastFocusedItem != null)
                {
                    if (m_lastFocusedItem is CollectionItem)
                    {
                        CollectionItem collectionItem = m_lastFocusedItem as CollectionItem;
                        //collectionItem.IsFocused = false;
                    }
                }
                m_lastFocusedItem = item;
                if (m_lastFocusedItem != null)
                {
                    if (m_lastFocusedItem is CollectionItem)
                    {
                        CollectionItem collectionItem = m_lastFocusedItem as CollectionItem;
                        //collectionItem.IsFocused = true;
                    }
                }
            }

            IsFocusing = m_focusedItemsPath.Count > 0;

            RaisePropertyChangedEvent("RootItems");
        }
Example #11
0
 private void OnDestroy()
 {
     RootItems.Clear();
 }