Esempio n. 1
0
        public void Execute()
        {
            if (_mainModel.Elements.Contains(_elementToRemove))
            {
                //removing connections of a Element
                foreach (ConnectorModel connectorModel in _elementToRemove.Connectors)
                {
                    for (int i = connectorModel.ConnectionModels.Count - 1; i >= 0; i--)
                    {
                        if (connectorModel.ConnectionModels[i] is ConnectionModel connectionModel)
                        {
                            RemoveConnectionCommand removeConnectionCommand =
                                new RemoveConnectionCommand(connectionModel, _mainModel);
                            removeConnectionCommand.Execute();
                            _mainModel.MyCommandManager.AddToList(removeConnectionCommand);
                        }
                    }
                }

                _elementToRemove.MainModelCommandManager = null;
                _mainModel.Elements.Remove(_elementToRemove);
            }
        }
Esempio n. 2
0
        public void Undo()
        {
            RemoveConnectionCommand removeConnectionCommand = new RemoveConnectionCommand(_connectionToAdd, _mainModel);

            removeConnectionCommand.Execute();
        }