/// <summary>
        /// Calculates result of inputted expression.
        /// </summary>
        private void CalculateResult(object sender, RoutedEventArgs e)
        {
            if (operationExecutor.State == ExecutorState.Error)
            {
                return;
            }

            if (operationExecutor.State == ExecutorState.FirstOperandInput)
            {
                operationExecutor.FirstOperand = inputValidator.getInput();
            }
            else
            {
                operationExecutor.SecondOperand = inputValidator.getInput();
            }
            double?result = operationExecutor.Calculate();

            if (operationExecutor.State == ExecutorState.ResultCalculated)
            {
                SetMainOutput(outputFormatter.MakeResult(result.Value));
                SetSecondaryOutput(outputFormatter.MakeTempExpression(operationExecutor.FirstOperand,
                                                                      operationExecutor.SecondOperand,
                                                                      operationExecutor.Operator));
            }
            else if (operationExecutor.State == ExecutorState.Error)
            {
                SetMainOutput(outputFormatter.PrintError());
                SetSecondaryOutput("");
            }

            operationExecutor.FirstOperand = result;
        }