Beispiel #1
0
        private void RebuildNavigation(bool recreate)
        {
            using (FlagManager.UseFlag("BuildingNavTree"))
            {
                if (ProjectManager.IsProjectOpen)
                {
                    var selectedNodeIDs = ProjectTreeView.SelectedObjects
                                          .OfType <ProjectTreeNode>().Select(x => x.NodeID).ToList();
                    selectedNodeIDs.RemoveAll(x => string.IsNullOrEmpty(x));

                    var expandedNodeIDs = ProjectTreeView.ExpandedObjects
                                          .OfType <ProjectTreeNode>().Select(x => x.NodeID).ToList();
                    expandedNodeIDs.RemoveAll(x => string.IsNullOrEmpty(x));
                    ProjectTreeView.ExpandedObjects = Enumerable.Empty <ProjectTreeNode>();

                    if (recreate)
                    {
                        ProjectTreeView.ClearObjects();

                        ProjectManager.RebuildNavigationTree();

                        ProjectTreeView.AddObjects(ProjectManager.NavigationTreeNodes.ToList());


                        foreach (ProjectCollectionNode node in ProjectTreeView.Roots)
                        {
                            node.Manager = ProjectManager;
                            ProjectTreeView.Expand(node);
                        }
                    }
                    else
                    {
                        foreach (ProjectTreeNode node in ProjectTreeView.Roots)
                        {
                            ProjectTreeView.RemoveObjects(node.GetChildHierarchy().ToList());
                            node.InvalidateChildrens();
                            ProjectTreeView.UpdateObject(node);
                        }
                    }


                    //ProjectTreeView.TreeModel.
                    ExpandNodes(ProjectTreeView.Roots, expandedNodeIDs);

                    if (selectedNodeIDs.Any())
                    {
                        SetSelectedNodeIDs(selectedNodeIDs);
                    }
                }
                else
                {
                    ProjectTreeView.ClearObjects();
                }

                FilterNavigation();
            }
        }
Beispiel #2
0
 private void ExpandNodes(IEnumerable nodes, List <string> nodeIDs)
 {
     foreach (ProjectTreeNode node in nodes)
     {
         if (nodeIDs.Contains(node.NodeID))
         {
             ProjectTreeView.Expand(node);
             ExpandNodes(node.Nodes, nodeIDs);
         }
     }
 }
Beispiel #3
0
 private void SelectElementNodeDelayed(PartElement element)
 {
     BeginInvoke((Action)(() =>
     {
         var elementNode = FindElementNode(element);
         if (elementNode.Parent != null)
         {
             ProjectTreeView.Expand(elementNode.Parent);
         }
         using (FlagManager.UseFlag("ManualSelect"))
             ProjectTreeView.SelectObject(elementNode);
     }));
 }
Beispiel #4
0
        protected override void OnProjectChanged()
        {
            base.OnProjectChanged();

            InitializeViewComboBox();
            RebuildNavigation(true);

            if (CurrentProject != null)
            {
                if (CurrentProject.Surfaces.Count == 1)
                {
                    var surfaceNode = FindElementNode(CurrentProject.Surfaces[0]);
                    if (surfaceNode != null)
                    {
                        ProjectTreeView.Expand(surfaceNode);
                    }
                }
            }
        }
Beispiel #5
0
        protected override void OnProjectChanged()
        {
            base.OnProjectChanged();

            InitializeViewComboBox();
            RebuildNavigation(true);

            if (CurrentProject != null)
            {
                if (CurrentProject.Surfaces.Count == 1)
                {
                    var surfaceNode = FindElementNode(CurrentProject.Surfaces[0]);
                    if (surfaceNode != null)
                    {
                        ProjectTreeView.Expand(surfaceNode);
                    }
                }
            }

            //string projectTitle = ProjectManager.GetProjectDisplayName();

            //ViewModeLabel.Text = ProjectManager.IsProjectOpen ? projectTitle : $"<{projectTitle}> ";
        }