public override void Execute() { if (_undoCommand != null) { throw new InvalidOperationException("The command has already been executed."); } Validate(); GraphicCollection parentCollection = ((CompositeGraphic)_graphic.ParentGraphic).Graphics; int restoreIndex = parentCollection.IndexOf(_graphic); parentCollection.Remove(_graphic); _undoCommand = new InsertGraphicCommand(_graphic, parentCollection, restoreIndex); _graphic = null; }
public override void Execute() { if (_undoCommand != null) throw new InvalidOperationException("The command has already been executed."); Validate(); GraphicCollection parentCollection = ((CompositeGraphic)_graphic.ParentGraphic).Graphics; int restoreIndex = parentCollection.IndexOf(_graphic); parentCollection.Remove(_graphic); _undoCommand = new InsertGraphicCommand(_graphic, parentCollection, restoreIndex); _graphic = null; }