public void RemoveNode(Node node) { if (node == null) { return; } if (NodeRemoving != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeRemoving(this, eventArgs); if (eventArgs.Cancel) { return; } } // if (HasFocus(node)) // FocusElement = null; DisconnectAll(node); _graphNodes.Remove(node); UpdateRevisionIndex(); if (InvalidateViews != null) { InvalidateViews(this, EventArgs.Empty); } if (NodeRemoved != null) { NodeRemoved(this, new NodeEventArgs(node)); } }
public bool AddNode(Node node) { if (node == null || _graphNodes.Contains(node)) { return(false); } _graphNodes.Insert(0, node); if (NodeAdded != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeAdded(this, eventArgs); if (eventArgs.Cancel) { _graphNodes.Remove(node); return(false); } } BringElementToFront(node); // FocusElement = node; UpdateRevisionIndex(); if (InvalidateViews != null) { InvalidateViews(this, EventArgs.Empty); } return(true); }
public bool AddNodes(IEnumerable <Node> nodes) { if (nodes == null) { return(false); } int index = 0; bool modified = false; Node lastNode = null; foreach (var node in nodes) { if (node == null) { continue; } if (_graphNodes.Contains(node)) { continue; } _graphNodes.Insert(index, node); index++; if (NodeAdded != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeAdded(this, eventArgs); if (eventArgs.Cancel) { _graphNodes.Remove(node); modified = true; } else { lastNode = node; } } else { lastNode = node; } } if (lastNode != null) { BringElementToFront(lastNode); // FocusElement = lastNode; UpdateRevisionIndex(); if (InvalidateViews != null) { InvalidateViews(this, EventArgs.Empty); } } return(modified); }
public bool RemoveNodes(IEnumerable <Node> nodes) { if (nodes == null) { return(false); } bool modified = false; foreach (var node in nodes) { if (node == null) { continue; } if (NodeRemoving != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeRemoving(this, eventArgs); if (eventArgs.Cancel) { continue; } } // if (HasFocus(node)) // FocusElement = null; DisconnectAll(node); _graphNodes.Remove(node); modified = true; if (NodeRemoved != null) { NodeRemoved(this, new NodeEventArgs(node)); } } if (modified) { UpdateRevisionIndex(); if (InvalidateViews != null) { InvalidateViews(this, EventArgs.Empty); } } return(modified); }
private void OnNodeAdded(object sender, AcceptNodeEventArgs args) { OnNodesChange(); }
public void RemoveNode(Node node) { if (node == null) return; if (NodeRemoving != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeRemoving(this, eventArgs); if (eventArgs.Cancel) return; } if (HasFocus(node)) FocusElement = null; DisconnectAll(node); graphNodes.Remove(node); this.Invalidate(); if (NodeRemoved != null) NodeRemoved(this, new NodeEventArgs(node)); }
public bool RemoveNodes(IEnumerable<Node> nodes) { if (nodes == null) return false; bool modified = false; foreach (var node in nodes) { if (node == null) continue; if (NodeRemoving != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeRemoving(this, eventArgs); if (eventArgs.Cancel) continue; } if (HasFocus(node)) FocusElement = null; DisconnectAll(node); graphNodes.Remove(node); modified = true; if (NodeRemoved != null) NodeRemoved(this, new NodeEventArgs(node)); } if (modified) this.Invalidate(); return modified; }
public bool AddNodes(IEnumerable<Node> nodes) { if (nodes == null) return false; int index = 0; bool modified = false; Node lastNode = null; foreach (var node in nodes) { if (node == null) continue; if (graphNodes.Contains(node)) continue; graphNodes.Insert(index, node); index++; if (NodeAdded != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeAdded(this, eventArgs); if (eventArgs.Cancel) { graphNodes.Remove(node); modified = true; } else lastNode = node; } else lastNode = node; } if (lastNode != null) { BringElementToFront(lastNode); FocusElement = lastNode; this.Invalidate(); } return modified; }
public bool AddNode(Node node) { if (node == null || graphNodes.Contains(node)) return false; graphNodes.Insert(0, node); if (NodeAdded != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeAdded(this, eventArgs); if (eventArgs.Cancel) { graphNodes.Remove(node); return false; } } BringElementToFront(node); FocusElement = node; this.Invalidate(); return true; }
public bool AddNode(Node node) { if (node == null || _graphNodes.Contains(node)) return false; _graphNodes.Insert(0, node); if (NodeAdded != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeAdded(this, eventArgs); if (eventArgs.Cancel) { _graphNodes.Remove(node); return false; } } BringElementToFront(node); // FocusElement = node; UpdateRevisionIndex(); if (InvalidateViews != null) InvalidateViews(this, EventArgs.Empty); return true; }
public bool RemoveNodes(IEnumerable<Node> nodes) { if (nodes == null) return false; bool modified = false; foreach (var node in nodes) { if (node == null) continue; if (NodeRemoving != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeRemoving(this, eventArgs); if (eventArgs.Cancel) continue; } // if (HasFocus(node)) // FocusElement = null; DisconnectAll(node); _graphNodes.Remove(node); modified = true; if (NodeRemoved != null) NodeRemoved(this, new NodeEventArgs(node)); } if (modified) { UpdateRevisionIndex(); if (InvalidateViews != null) InvalidateViews(this, EventArgs.Empty); } return modified; }
public void RemoveNode(Node node) { if (node == null) return; if (NodeRemoving != null) { var eventArgs = new AcceptNodeEventArgs(node); NodeRemoving(this, eventArgs); if (eventArgs.Cancel) return; } // if (HasFocus(node)) // FocusElement = null; DisconnectAll(node); _graphNodes.Remove(node); UpdateRevisionIndex(); if (InvalidateViews != null) InvalidateViews(this, EventArgs.Empty); if (NodeRemoved != null) NodeRemoved(this, new NodeEventArgs(node)); }