예제 #1
0
 public _Node GetNodeById(int id)
 {
     lock (AllNodesLock)
     {
         return(AllNodes.FirstOrDefault(n => n.Id == id));
     }
 }
예제 #2
0
 public _Node GetNodeAt(Point p)
 {
     lock (AllNodesLock)
     {
         return(AllNodes.FirstOrDefault(n => n.Visualizer.OnIt(p)));
     }
 }
예제 #3
0
 public _Node GetMinimumNode()
 {
     lock (AllNodesLock)
     {
         return(AllNodes.FirstOrDefault(fn => fn.Id == AllNodes.Min(n => n.Id)));
     }
 }
예제 #4
0
        public ISpecNode FindSpecNode(SpecPath path)
        {
            if (path.FullName.IsEmpty())
            {
                return(this);
            }

            var fullName = path.FullName;

            return(AllNodes.FirstOrDefault(x => x.FullName == fullName));
        }
예제 #5
0
 public void MarkAsSelected(Module module, BackgroundWorker worker)
 {
     if (WasCancelled(worker) && SelectedNode != null)
     {
         return;
     }
     SelectedNode = AllNodes.FirstOrDefault(n => ((ModuleNode)n.Tag).Module.Equals(module));
     if (WasCancelled(worker) || SelectedNode == null)
     {
         return;
     }
     EnsureVisible(SelectedNode);
 }
예제 #6
0
        public void DisplayKeepingSelection(IEnumerable <Module> modules)
        {
            var lastSelectedDeviareNode = SelectedDeviareNode;

            Display(modules);

            var first =
                AllNodes.FirstOrDefault(
                    n => ((DeviareNode)n.Tag).DeviareNodeName.Equals(lastSelectedDeviareNode.DeviareNodeName));

            if (first != null)
            {
                first.IsSelected = true;
            }
        }
예제 #7
0
        public void CanCopyAndPasteAllNodesOnRevit(NodeModelSearchElement searchElement)
        {
            var model = ViewModel.Model;

            searchElement.ProduceNode(); // puts the node into the current workspace

            var node = AllNodes.FirstOrDefault();

            DynamoSelection.Instance.ClearSelection();
            DynamoSelection.Instance.Selection.Add(node);
            Assert.AreEqual(1, DynamoSelection.Instance.Selection.Count);

            Assert.DoesNotThrow(() => model.Copy(), string.Format("Could not copy node : {0}", node.GetType()));
            Assert.DoesNotThrow(() => model.Paste(), string.Format("Could not paste node : {0}", node.GetType()));

            model.ClearCurrentWorkspace();
        }