private void Calculate() { string currEq = lblCurr.Content.ToString(); string formatedEQ = string.Empty, result = currEq; if (currEq.Length > 1) { if (Calculus.CalculaceCalculator(ref result, ref formatedEQ)) //OK { lblCurr.Content = result; lblEq.Content = formatedEQ; brdEq.BorderBrush = new SolidColorBrush(Color.FromRgb(239, 201, 175)); } else //WRONG { brdEq.BorderBrush = Brushes.Red; toClear = false; lblCurr.Content = currEq; lblEq.Content = result; } } else if (currEq.Length == 1) { Regex regex = new Regex(@"\d"); if (regex.IsMatch(currEq)) { lblCurr.Content = result; brdEq.BorderBrush = new SolidColorBrush(Color.FromRgb(239, 201, 175)); lblEq.Content = currEq; } } SetSize(); }
public Analyzer() { this.digits = new Queue <string>(); this.symbols = new Stack <string>(); this.values = new List <string>(); calc = new Calculus(); }