Example #1
0
        public void Undo(int levels)
        {
            Console.WriteLine("\n---- Undo {0} levels ", levels);

            // Perform undo operations
            for (int i = 0; i < levels; i++)
            {
                if (currentCommand > 0)
                {
                    Command command = commands[--currentCommand] as Command;
                    command.UnExecute();
                }
            }
        }
Example #2
0
        public void Undo(int levels)
        {
            Console.WriteLine($"\n---- Undo {levels} levels ");

            // Perform undo operations
            for (int i = 0; i < levels; i++)
            {
                if (_current > 0)
                {
                    Command command = _commands[--_current] as Command;
                    command.UnExecute();
                }
            }
        }
        //Undo X times (1 default)
        public void Undo(int levels = 1)
        {
            Console.WriteLine("\n---- Undo {0} levels ", levels);
            // Perform undo operations

            if (levels == 0)
            {
                levels = _commands.Count;
            }

            for (int i = 0; i < levels; i++)
            {
                if (_current > 0)
                {
                    Command command = _commands[--_current] as Command;
                    command.UnExecute();
                }
            }
        }