예제 #1
0
        private void BtnOperant_Click(object sender, RoutedEventArgs e)
        {
            if ((string)((Button)e.Source).Content != "C")
            {
                saveNumber();
            }
            switch ((string)((Button)e.Source).Content)
            {
            case "+":
                calc.AddOperator(Operator.Add);
                Display.Content += " + ";
                break;

            case "-":
                calc.AddOperator(Operator.Substract);
                Display.Content += " - ";
                break;

            case "*":
                calc.AddOperator(Operator.Multiply);
                Display.Content += " * ";
                break;

            case "/":
                calc.AddOperator(Operator.Divide);
                Display.Content += " / ";
                break;

            case "CE":
                calc.Clear();
                Display.Content = string.Empty;
                break;

            case "C":
                Clear();
                break;

            case "=":
                Display.Content = string.Empty;
                Display.Content = calc.GetResult(true).ToString();
                resultShowed    = true;
                break;

            case "(":
                calc.AddOperator(Operator.BracketOpen);
                Display.Content += "(";
                break;

            case ")":
                calc.AddOperator(Operator.BracketClose);
                Display.Content += ")";
                break;

            case "sin":
                calc.AddOperator(Operator.Sinus);
                Display.Content += " sin";
                break;

            default:
                break;
            }
        }