private void Clear_Click(object sender, RoutedEventArgs e) { EqualsButton.IsEnabled = false; PercentButon.IsEnabled = false; Button_Div.IsEnabled = false; Button_Mult.IsEnabled = false; Button_Add.IsEnabled = false; Button_Minus.IsEnabled = false; Button_Point.IsEnabled = false; Button_1x.IsEnabled = false; Button_x2.IsEnabled = false; Button_root.IsEnabled = false; ArenaofCaclulateTextBox.Clear(); ArenaofCaclulateTextBox.Text.Trim(); result.Equals(null); }
private void Number_Click(object sender, RoutedEventArgs e) { EqualsButton.IsEnabled = true; PercentButon.IsEnabled = true; Button_Div.IsEnabled = true; Button_Mult.IsEnabled = true; Button_Add.IsEnabled = true; Button_Minus.IsEnabled = true; Button_Point.IsEnabled = true; Button_1x.IsEnabled = true; Button_x2.IsEnabled = true; Button_root.IsEnabled = true; if (isOperationprocess) { ArenaofCaclulateTextBox.Clear(); } if (sender is Button button) { if (button.Content == ".") { if (!ArenaofCaclulateTextBox.Text.Contains(".")) { ArenaofCaclulateTextBox.Text = ArenaofCaclulateTextBox.Text + button.Content; } } if (button.Content != ".") { ArenaofCaclulateTextBox.Text = ArenaofCaclulateTextBox.Text + button.Content; } if (ArenaofCaclulateTextBox.Text.Length > 10) { ArenaofCaclulateTextBox.Text = "Imposible"; EqualsButton.IsEnabled = false; PercentButon.IsEnabled = false; Button_Div.IsEnabled = false; Button_Mult.IsEnabled = false; Button_Add.IsEnabled = false; Button_Minus.IsEnabled = false; Button_Point.IsEnabled = false; Button_1x.IsEnabled = false; Button_x2.IsEnabled = false; Button_root.IsEnabled = false; } int resultButton = ArenaofCaclulateTextBox.Text.ToCharArray().Count(c => c == '.'); if (resultButton > 1) { ArenaofCaclulateTextBox.Text = "Imposible"; EqualsButton.IsEnabled = false; PercentButon.IsEnabled = false; Button_Div.IsEnabled = false; Button_Mult.IsEnabled = false; Button_Add.IsEnabled = false; Button_Minus.IsEnabled = false; Button_Point.IsEnabled = false; Button_1x.IsEnabled = false; Button_x2.IsEnabled = false; Button_root.IsEnabled = false; } isOperationprocess = false; } }