public void DeleteComponent(UIPlaceable component)
        {
            PnmlNet.PetriNet.Objects.Remove(component);
            if (component is Connection conn)
            {
                var related = PnmlNet.PetriNet.Objects.GetConnectables().Where(o => o.Id == conn.SourceId || o.Id == conn.DestinationId);
                foreach (var rel in related)
                {
                    PnmlNet.PetriNet.InitDependency(rel);
                }

                ArrowManagement.Remove(conn.Source, conn.Destination);
                var otherConnectionsBetweenRemoved =
                    PnmlNet.PetriNet.Objects.GetAllConnectionsBetween2Connectables(conn.Source, conn.Destination);
                foreach (var c in otherConnectionsBetweenRemoved)
                {
                    c.UpdateArrows();
                }

                conn.Source.Output.Remove(conn);
                conn.Destination.Input.Remove(conn);
                if (conn.Destination is Transition trans)
                {
                    trans.CalcIsExecutable();
                }
            }
            if (component is ConnectableBase connectable)
            {
                //foreach(var outputConn in connectable.Output)
                while (connectable.Output.Count > 0)
                {
                    DeleteComponent(connectable.Output[0]);
                }
                //foreach (var inputConn in connectable.Input)
                while (connectable.Input.Count > 0)
                {
                    DeleteComponent(connectable.Input[0]);
                }
            }
        }
 bool DeleteCommandCanExecute(UIPlaceable item)
 {
     return(EditorMode == EditorMode.Delete);
 }
 void DeleteCommandExecute(UIPlaceable item)
 {
     DeleteComponent(item);
 }