public void PressKey(int keyIndex) { if (keyIndex < _operations.Count) { Operation operation = _operations[keyIndex]; if (_input.AddChar(operation.ShortCut)) { return; } if (operation.ShortCut == '\b' && _calculationStack.Count > 0) { _calculationStack.Pop(); return; } if (operation.HasFunction) { if (_input.IsActive) { _calculationStack.Push(_input.ToDouble()); _input.Clear(); if (operation.Name == "Enter") { return; } } operation.Execute(_calculationStack); } } }