Esempio n. 1
0
        public void Compute(char @operator, int operand)
        {
            var command = new CalculatorCommand(_calculator, @operator, operand);

            command.Execute();
            _commands.Add(command);
            _current++;
        }
Esempio n. 2
0
        public void Compute(char @operator, int operand)
        {
            Command command = new CalculatorCommand(this.calculator, @operator, operand);
            command.Execute();

            this.commands.Add(command);
            this.current++;
        }
Esempio n. 3
0
        public void Compute(char @operator, int operand)
        {
            // Create command operation and execute it
            Command command = new CalculatorCommand(_calculator, @operator, operand);

            command.Execute();
            _commands.Add(command);
            _commandsCount++;
        }
Esempio n. 4
0
        public void Compute(char @operator, int operand)
        {
            Command command = new CalculatorCommand(this.calculator, @operator, operand);

            command.Execute();

            this.commands.Add(command);
            this.current++;
        }
Esempio n. 5
0
        public void Compute(char @operator, int operand)
        {
            // create the command and execute it
            var command = new CalculatorCommand(@operator, operand, _calculator);

            command.Execute();

            // Add operation to the cancel list
            _commandHistory.Add(command);
            _current++;
        }
Esempio n. 6
0
        public void Compute(char @operator, int operand)
        {
            // Create command opearation and execue it
            Command command = new CalculatorCommand(_calculator, @operator, operand);

            command.Execute();

            //Add command to undo list
            _commands.Add(command);
            _current++;
        }
Esempio n. 7
0
        public void Compute(char @operator, int operand)
        {
            // Create command operation and execute it
            Command command = new CalculatorCommand(
              _calculator, @operator, operand);
            command.Execute();

            // Add command to undo list
            _commands.Add(command);
            _current++;
        }
Esempio n. 8
0
        /// <summary>
        /// The compute.
        /// </summary>
        /// <param name="operator">
        /// The operator.
        /// </param>
        /// <param name="operand">
        /// The operand.
        /// </param>
        public void Compute(char @operator, int operand)
        {
            // Create command operation and execute it
            AnAbstractCommand command = new CalculatorCommand(
                this.Calculator, @operator, operand);

            command.Execute();

            // Add command to undo list
            this.Commands.Add(command);
            this.Current++;
        }
Esempio n. 9
0
        public void Compute(char @operator, int operand)
        {
            Command command = new CalculatorCommand(
                _calculator, @operator, operand);

            command.Execute();

            if (_current < _commands.Count)
            {
                _commands.RemoveRange(_current, _commands.Count - _current);
            }

            _commands.Add(command);
            _current++;
        }
Esempio n. 10
0
        public void Compute(char @operator, int operand)
        {
            // Create command operation and execute it

            Command command = new CalculatorCommand(
                _calculator, @operator, operand);

            command.Execute();

            //fix the redo list bug
            if (_commands.Count > _current)
            {
                _commands.RemoveRange(_current, _commands.Count - _current);
            }

            // Add command to undo list
            _commands.Add(command);
            _current++;
        }
Esempio n. 11
0
        public void Compute(char @operator, int operand)
        {
            // Создаем команду операции и выполняем её
            Command command = new CalculatorCommand(
                _calculator, @operator, operand);

            command.Execute();

            if (_current < _commands.Count)
            {
                // если "внутри undo" мы запускаем новую операцию,
                // надо обрубать список команд, следующих после текущей,
                // иначе undo/redo будут некорректны
                _commands.RemoveRange(_current, _commands.Count - _current);
            }

            // Добавляем операцию к списку отмены
            _commands.Add(command);
            _current++;
        }
Esempio n. 12
0
    public void Compute(char @operator, int operand)
    {

      // Создаем команду операции и выполняем её
      Command command = new CalculatorCommand(
        _calculator, @operator, operand);
      command.Execute();

	if (_current < _commands.Count)
	{
	    // если "внутри undo" мы запускаем новую операцию, 
	    // надо обрубать список команд, следующих после текущей, 
	    // иначе undo/redo будут некорректны
		_commands.RemoveRange(_current, _commands.Count - _current);
	}

      // Добавляем операцию к списку отмены
      _commands.Add(command);
      _current++;
    }