Example #1
0
        /// <summary>
        /// Helper for Undo Redo system. Does not trigger new undo added to stack
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Tuple <string, Point, List <Tuple <string, List <NodeOutputConnection> > > > RemoveNode(string id)
        {
            var n = GraphNodes.Find(m => m.Id.Equals(id));

            Tuple <string, Point, List <Tuple <string, List <NodeOutputConnection> > > > result = null;

            if (n != null)
            {
                result = new Tuple <string, Point, List <Tuple <string, List <NodeOutputConnection> > > >(n.Node.GetJson(), n.Origin, n.Node.GetParentsConnections());

                //to remove connections but not to remove from graph
                n.DisposeNoRemove();

                GraphNodes.Remove(n);
                ViewPort.Children.Remove(n);
                lookup.Remove(n.Id);

                //remove from underlying graph
                Graph.Remove(n.Node);

                Modified = true;
            }

            return(result);
        }
Example #2
0
        public void RemoveNode(UINode n)
        {
            string json = n.Node.GetJson();
            Point  p    = n.Origin;

            UndoRedoManager.AddUndo(new UndoDeleteNode(Id, json, p, n.Node.GetParentsConnections(), this));

            GraphNodes.Remove(n);
            ViewPort.Children.Remove(n);
            lookup.Remove(n.Id);

            //remove from underlying graph
            Graph.Remove(n.Node);

            Modified = true;
        }