private void ClearGraph() { //Set Entry point GUID Nodes.Find(x => x.EntryPoint).GUID = _containerCache.NodeLinks[0].BaseNodeGUID; foreach (var node in Nodes) { if (node.EntryPoint) { continue; } //get all output connections from this node Edges.Where(x => x.input.node == node).ToList() //Remove all connections .ForEach(edge => _targetGraphView.RemoveElement(edge)); // Remove the node _targetGraphView.RemoveElement(node); } }
private void ClearGraph() { if (!Nodes.Any()) { return; } if (Edges.Any()) { Nodes.Find(x => x.EntryPoint).GUID = _containerCache.nodeLinks[0].sourceNodeGuid; } foreach (var perNode in Nodes) { /*if (perNode.EntryPoint) * { * perNode.RefreshPorts(); * continue; * }*/ Edges.Where(x => x.input.node == perNode).ToList() .ForEach(edge => _targetGraphView.RemoveElement(edge)); _targetGraphView.RemoveElement(perNode); } }