Example #1
0
        private static void Main(string[] args)
        {
            Manipulator manipulator = new Manipulator();
            Console.WriteLine(manipulator.GetState());

            RemoteController controller = new RemoteController(manipulator);
            controller.Up(10);
            Console.WriteLine(manipulator.GetState());

            controller.Left(20);
            Console.WriteLine(manipulator.GetState());

            controller.Right(10);
            Console.WriteLine(manipulator.GetState());

            controller.Down(30);
            Console.WriteLine(manipulator.GetState());

            controller.UndoLastCommand();
            Console.WriteLine(manipulator.GetState());

            controller.UndoLastCommand();
            Console.WriteLine(manipulator.GetState());

            controller.UndoLastCommand();
            Console.WriteLine(manipulator.GetState());

            controller.UndoLastCommand();
            Console.WriteLine(manipulator.GetState());

            Console.ReadLine();
        }
Example #2
0
 public RemoteController(Manipulator manipulator)
 {
     this.manipulator = manipulator;
 }
 public override void Undo(Manipulator manipulator)
 {
     manipulator.MoveVertical(Distance);
 }
 public override void Undo(Manipulator manipulator)
 {
     manipulator.MoveHorisontal(-Distance);
 }
Example #5
0
 public abstract void Undo(Manipulator manipulator);