Пример #1
0
        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);
        }
Пример #2
0
        public void RemoveSingleCanvasItem(CanvasItem item)
        {
            if (itemsList.Contains(itemsData[item]))
            {
                itemsList.Remove(itemsData[item]);
            }

            diagramRouter.RemoveItem(item);
        }
Пример #3
0
        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);
        }