private void EditClearAll_Click(object sender, RoutedEventArgs e)
 {
     _operator  = SecondArgumentAction.None;
     resultText = "0";
     Info.Text  = "";
     _value     = 0;
     DigitGrouping(resultText);
 }
        private void CalculateReciprocal_Click(object sender, RoutedEventArgs e)
        {
            double dTemp = Convert.ToDouble(resultText.Replace(_decimalDelimiter, "."), _invariantNF);

            dTemp      = 1.0 / dTemp;
            resultText = Convert.ToString(dTemp).Replace(_decimalDelimiter, ".");
            _operator  = SecondArgumentAction.Clear;
            DigitGrouping(resultText);
        }
        public void Percent_Action(object o)
        {
            if (_operator != SecondArgumentAction.Clear &&
                _operator != SecondArgumentAction.None)
            {
                CalculateResult_Action(o);
            }

            _operator    = SecondArgumentAction.Percent;
            _value       = Convert.ToDouble(resultText.Replace(_decimalDelimiter, "."), _invariantNF);
            resultText   = "0";
            percentvalue = _value;
            Info.Text    = _value.ToString() + " %";
            DigitGrouping(resultText);
        }
        public void NumberNine_Action(object o)
        {
            if (_operator == SecondArgumentAction.Clear)
            {
                resultText = "0";
                _operator  = SecondArgumentAction.None;
            }

            if (resultText == "0")
            {
                resultText = "9";
            }
            else
            {
                resultText += "9";
            }
            DigitGrouping(resultText);
        }
        public void CalculateResult_Action(object o)
        {
            double dTemp = _value;

            _value = Convert.ToDouble(resultText.Replace(_decimalDelimiter, "."), _invariantNF);
            switch (_operator)
            {
            case SecondArgumentAction.Add:
                resultText = Convert.ToString(dTemp + _value).Replace(_decimalDelimiter, ".");
                _operator  = SecondArgumentAction.Clear;
                DigitGrouping(resultText);
                break;

            case SecondArgumentAction.Substract:
                resultText = Convert.ToString(dTemp - _value).Replace(_decimalDelimiter, ".");
                _operator  = SecondArgumentAction.Clear;
                DigitGrouping(resultText);
                break;

            case SecondArgumentAction.Multiply:
                resultText = Convert.ToString(dTemp * _value).Replace(_decimalDelimiter, ".");
                _operator  = SecondArgumentAction.Clear;
                DigitGrouping(resultText);
                break;

            case SecondArgumentAction.Divide:
                if (_value != 0.0)
                {
                    resultText = Convert.ToString(dTemp / _value).Replace(_decimalDelimiter, ".");
                }
                else
                {
                    resultText = Convert.ToString(System.Double.MaxValue).Replace(_decimalDelimiter, ".");
                }
                _operator = SecondArgumentAction.Clear;
                if (_value == 0)
                {
                    Entry.Text = "∞";
                    break;
                }
                DigitGrouping(resultText);
                break;

            case SecondArgumentAction.Percent:
                if (_value != 0.0)
                {
                    resultText = Convert.ToString(percentvalue * _value / 100.0).Replace(_decimalDelimiter, ".");
                }
                else
                {
                    resultText = Convert.ToString(percentvalue * _value / 100.0).Replace(_decimalDelimiter, ".");
                }
                if (_value == 0)
                {
                    Entry.Text = "∞";
                    break;
                }
                _operator = SecondArgumentAction.Clear;
                DigitGrouping(resultText);
                break;
            }
            if (_operator == SecondArgumentAction.Clear)
            {
                Info.Text = "";
            }
        }