/// <summary> /// <see cref="Unexecute"/>s the insert command (e.g. removes the graphic). /// </summary> public override void Unexecute() { if (_command is RemoveGraphicCommand) { _command.Execute(); _command = ((RemoveGraphicCommand)_command).GetUndoCommand(); } }
/// <summary> /// <see cref="Execute"/>s the insert command. /// </summary> public override void Execute() { if (_command is InsertGraphicCommand) { _command.Execute(); _command = ((InsertGraphicCommand)_command).GetUndoCommand(); } }
/// <summary> /// On first call, adds the graphic to the collection. Subsequent calls perform an insert. /// </summary> public override void Execute() { if (_command is AddGraphicCommand) { _command.Execute(); _command = ((AddGraphicCommand)_command).GetUndoCommand(); } else if (_command is InsertGraphicCommand) { //after the initial add has executed (and has been undone) it's an insert from then on. _command.Execute(); _command = ((InsertGraphicCommand)_command).GetUndoCommand(); } }
/// <summary> /// Constructor. /// </summary> public InsertGraphicUndoableCommand(IGraphic graphic, GraphicCollection parentCollection, int index) { _command = new InsertGraphicCommand(graphic, parentCollection, index); }
/// <summary> /// Constructor. /// </summary> public AddGraphicUndoableCommand(IGraphic graphic, GraphicCollection parentCollection) { _command = new AddGraphicCommand(graphic, parentCollection); }
/// <summary> /// Constructor. /// </summary> /// <remarks> /// The <paramref name="graphic"/>'s <see cref="IGraphic.ParentGraphic"/> must not be null. /// </remarks> public RemoveGraphicUndoableCommand(IGraphic graphic) { _command = new RemoveGraphicCommand(graphic); }