Command.cs
Upload User: sxsgcs
Upload Date: 2013-10-21
Package Size: 110k
Code Size: 1k
Category:

CAD

Development Platform:

C#

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. /// Undo-Redo code is written using the article:
  5. /// http://www.codeproject.com/cs/design/commandpatterndemo.asp
  6. //  The Command Pattern and MVC Architecture
  7. //  By David Veeneman.
  8. namespace DrawTools
  9. {
  10.     /// <summary>
  11.     /// Base class for commands used for Undo - Redo
  12.     /// </summary>
  13.     abstract class Command
  14.     {
  15.         // This function is used to make Undo operation.
  16.         // It makes action opposite to the original command.
  17.         public abstract void Undo(GraphicsList list);
  18.         // This command is used to make Redo operation.
  19.         // It makes original command again.
  20.         public abstract void Redo(GraphicsList list);
  21.         // Derived classes have members which contain enough information
  22.         // to make Undo and Redo operations for every specific command.
  23.     }
  24. }