Example #1
0
        private void EqualBtn_Click(object sender, RoutedEventArgs e)
        {
            double newNum;

            if (double.TryParse(resultLb.Content.ToString(), out newNum))
            {
                switch (selectedOperator)
                {
                case selectedOperator.Addition:
                    result = SimpleMath.Add(lastNum, newNum);
                    break;

                case selectedOperator.Soustraction:
                    result = SimpleMath.Sous(lastNum, newNum);
                    break;

                case selectedOperator.Multiplication:
                    result = SimpleMath.Multi(lastNum, newNum);
                    break;

                case selectedOperator.Division:
                    result = SimpleMath.Div(lastNum, newNum);
                    break;
                }
            }
            resultLb.Content = result.ToString();
        }