private void ContextItemDeleteSelectedElements_Click(object sender, EventArgs e) { var al = new ArrayList(); foreach (IViewerObject ob in gViewer.Entities) { if (ob.MarkedForDragging) { al.Add(ob); } } foreach (IViewerObject ob in al) { if (ob.DrawingObject is IViewerEdge edge) { gViewer.RemoveEdge(edge, true); } else { if (ob is IViewerNode node && node.Node.Id != "Source" && node.Node.Id != "Seed") { gViewer.RemoveNode(node, true); } } } }
void deleteSelected_Click(object sender, EventArgs e) { var al = new ArrayList(); foreach (IViewerObject ob in gViewer.Entities) { if (ob.MarkedForDragging) { al.Add(ob); } } foreach (IViewerObject ob in al) { var edge = ob.DrawingObject as IViewerEdge; if (edge != null) { gViewer.RemoveEdge(edge, true); } else { var node = ob as IViewerNode; if (node != null) { gViewer.RemoveNode(node, true); } } } }
private void DeleteSelectedNode() { var al = new ArrayList(); foreach (IViewerObject ob in _currentGViewer.Entities) { if (ob.MarkedForDragging) { al.Add(ob); } } foreach (IViewerObject ob in al) { var edge = ob.DrawingObject as IViewerEdge; if (edge != null) { _currentGViewer.RemoveEdge(edge, true); } else { var node = ob as IViewerNode; if (node != null) { _currentGViewer.RemoveNode(node, true); } } } }
private void removeEntityToolStripMenuItem_Click(object sender, EventArgs e) { string entityName = GetSelectedEntityNameInDiagram(); if (entityName == null) { return; } gviewer.Graph.RemoveNode(clickedNode.DrawingObject as Node); gviewer.RemoveNode(clickedNode as IViewerNode, false); gviewer.Refresh(); foreach (ListViewItem item in lvEntity.Items) { if (item.Text.Equals(entityName)) { item.Checked = false; } } StatusText = $"{entityName} removed from the diagram and selection."; }