public void RemoveCanvasItem(CanvasItem item) { itemsList.Remove(itemsData[item]); Stack <Route> routesToRemove = new Stack <Route>(); foreach (Route r in diagramRouter.Routes) { if (r.From == item || r.To == item) { routesToRemove.Push(r); } } foreach (Route r in routesToRemove) { diagramRouter.RemoveRoute(r); } diagramRouter.RemoveItem(item); ClassCanvasItem classItem = item as ClassCanvasItem; if (classItem != null) { classesToData.Remove(classItem.RepresentedClassType); } LayoutChanged(this, EventArgs.Empty); }
public void RemoveSingleCanvasItem(CanvasItem item) { if (itemsList.Contains(itemsData[item])) { itemsList.Remove(itemsData[item]); } diagramRouter.RemoveItem(item); }
public void RemoveCanvasItem(CanvasItem item) { if (item == null) { return; } itemsList.Remove(itemsData[item]); Stack <Route> routesToRemove = new Stack <Route>(); foreach (Route r in diagramRouter.Routes) { if (r.From == item || r.To == item) { routesToRemove.Push(r); } } foreach (Route r in routesToRemove) { diagramRouter.RemoveRoute(r); } diagramRouter.RemoveItem(item); NodeCanvasItem classItem = item as NodeCanvasItem; if (classItem != null) { nodesToData.Remove(classItem.GetNodeData); } itemsData.Remove(item); LayoutChanged(this, EventArgs.Empty); }