CommandAdd.cs 622 B

12345678910111213141516171819202122232425
  1. namespace PaintDotNet.Annotation.Command
  2. {
  3. class CommandAdd : Command
  4. {
  5. DrawObject drawObject;
  6. // Create this command with DrawObject instance added to the list
  7. public CommandAdd(DrawObject drawObject) : base()
  8. {
  9. // Keep copy of added object
  10. this.drawObject = drawObject.Clone();
  11. }
  12. public override void Undo(GraphicsList list)
  13. {
  14. list.DeleteLastAddedObject();
  15. }
  16. public override void Redo(GraphicsList list)
  17. {
  18. list.UnselectAll();
  19. list.Add(drawObject);
  20. }
  21. }
  22. }