private void buttonCompute_Click(object sender, EventArgs e) { var expression = textInput.Text; var result = ArithmeticExpression.ComputeResult(expression); textOutput.Text = result.ToString(); }
private void listViewHistory_Click(object sender, EventArgs e) { var lastIndex = listViewHistory.SelectedIndices.Count - 1; var index = listViewHistory.SelectedIndices[lastIndex]; if (index == 0) { return; } var expressions = listViewHistory.Items.Cast <ListViewItem>().Select(item => item.Text).ToList(); var result = ArithmeticExpression.AddResults(expressions, index); textOutput.Text = result.ToString(); }