private void ClearButton_Click(object sender, RoutedEventArgs e) { score = 0; number = 0; ScoreTextBlock.Text = "0"; CalcTextBox.Text = "0"; spyMinus = 0; CalcTextBox.SelectAll(); CalcTextBox.Focus(); }
private void ButonMinus_Click(object sender, RoutedEventArgs e) { tBox = CalcTextBox.Text; number = Double.Parse(tBox); if (spy == 1) { score = score + number; spy = 0; } else { if (spy == 3) { score = score / number; spy = 0; } else { if (spyMinus == 0) { score = (score - number) * (-1); spyMinus = 1; } else { if (spy == 4) { score = score * number; spy = 0; } else { score = score - number; } } } } tBox = score.ToString(CultureInfo.InvariantCulture); CalcTextBox.Text = tBox; ScoreTextBlock.Text = tBox + " -"; spy = 2; CalcTextBox.SelectAll(); CalcTextBox.Focus(); }
private void ButonPlus_Click(object sender, RoutedEventArgs e) { tBox = CalcTextBox.Text; number = Double.Parse(tBox); if (spy == 2) { score = score - number; spy = 0; } else { if (spy == 3) { score = score / number; spy = 0; } else { if (spy == 4) { score = score * number; spy = 0; } else { score = number + score; } } } tBox = score.ToString(CultureInfo.InvariantCulture); CalcTextBox.Text = tBox; ScoreTextBlock.Text = tBox + " +"; spy = 1; CalcTextBox.SelectAll(); CalcTextBox.Focus(); }