コード例 #1
0
        private void buttonCompute_Click(object sender, EventArgs e)
        {
            var expression = textInput.Text;
            var result     = ArithmeticExpression.ComputeResult(expression);

            textOutput.Text = result.ToString();
        }
コード例 #2
0
        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();
        }