protected void OnMultiplicarClicked(object sender, EventArgs e) { cont_punto = 0; valor_a = Convert.ToDouble(Pantalla.Text); Pantalla.DeleteText(0, Pantalla.Text.Length); signo = "*"; }
protected void OnBBorrarClicked(object sender, EventArgs e) { if (flag == 0) { Pantalla.DeleteText(Pantalla.Text.Length - 1, Pantalla.Text.Length); } }
protected void OnBRestarClicked(object sender, EventArgs e) { a = Convert.ToDouble(this.Pantalla.Text); c = "-"; Pantalla.DeleteText(0, Pantalla.Text.Length); flag = 0; }
protected void OnBProductoClicked(object sender, EventArgs e) { num1 = Convert.ToSingle(Pantalla.Text); Pantalla.DeleteText(0, Pantalla.Text.Length); contador = 0; opcion = 3; }
//cero protected void OnBceroClicked(object sender, EventArgs e) { String display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(display + " 0 "); }
protected void OnBIgualClicked(object sender, EventArgs e) { num2 = Convert.ToSingle(Pantalla.Text); String display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); switch (opcion) { case ("+"): resultado = operacion.suma(num1, num2); this.Pantalla.Text = (Convert.ToString(resultado)); contadorigual++; break; case ("-"): resultado = operacion.resta(num1, num2); this.Pantalla.Text = (Convert.ToString(resultado)); contadorigual++; break; case ("*"): resultado = operacion.multiplicacion(num1, num2); this.Pantalla.Text = (Convert.ToString(resultado)); contadorigual++; break; case ("/"): resultado = operacion.division(num1, num2); this.Pantalla.Text = (Convert.ToString(resultado)); contadorigual++; break; } }
//boton suma protected void OnBsumaClicked(object sender, EventArgs e) { numero1 = Convert.ToSingle(Pantalla.Text); Pantalla.DeleteText(0, Pantalla.Text.Length); contador2 = 0; opcion = "+"; }
protected void OnBDivisionClicked(object sender, EventArgs e) { num1 = Convert.ToSingle(Pantalla.Text); String display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); opcion = "/"; }
protected void OnClickedIgual(object sender, EventArgs e) { String Display = Pantalla.Text.ToString(); operando2 = double.Parse(Pantalla.Text); Pantalla.DeleteText(0, Pantalla.Text.Length); calcula(); res = true; }
protected void OnB9Clicked(object sender, EventArgs e) { if (flag == 0) { String Display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(Display + "9"); } }
//boton resta protected void OnBrestaClicked(object sender, EventArgs e) { numero1 = Convert.ToSingle(Pantalla.Text); String display = Pantalla.Text.ToString(); //Pantalla.InsertText(display + " - "); Pantalla.DeleteText(0, Pantalla.Text.Length); opcion = "-"; }
protected void OnClickedpunto(object sender, EventArgs e) { if (Pantalla.Text.IndexOf(",") < 0) { String Display = Pantalla.Text; Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(Display + ","); } }
protected void OnBorrarClicked(object sender, EventArgs e) { Pantalla.DeleteText(Pantalla.Text.Length - 1, Pantalla.Text.Length); string display = Pantalla.Text; if (display.Contains(".")) { } }
//NUEVE ====================================================// protected void OnCnueveClicked(object sender, EventArgs e) { if (contador_igual == 0) { String display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(display + "9"); } }
//DIVISIÓN protected void OnCdividirClicked(object sender, EventArgs e) { if (contador_igual == 0) { opcion = 4; num1 = Convert.ToSingle(Pantalla.Text); Pantalla.DeleteText(0, Pantalla.Text.Length); } }
//boton punto(.) protected void OnBpuntoClicked(object sender, EventArgs e) { if (contador == 0) { String display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(display + ","); contador++; } }
//boton borrar solo un numero protected void OnBcClicked(object sender, EventArgs e) { Pantalla.DeleteText(Pantalla.Text.Length - 1, Pantalla.Text.Length); String display = Pantalla.Text.ToString(); if (display.Contains(",")) { contador = 0; } }
protected void OnClickedReset(object sender, EventArgs e) { if (!Pantalla.Text.Equals("")) { String Display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); operacion = ""; operando1 = 0; operando2 = 0; } }
protected void OnClickedC(object sender, EventArgs e) { if (res) { } else { String Display = Pantalla.Text.ToString(); Pantalla.DeleteText((Pantalla.Text.Length - 1), Pantalla.Text.Length); } }
protected void OnClickedSuma(object sender, EventArgs e) { if (!Pantalla.Text.Equals("")) { String Display = Pantalla.Text; operacion = "+"; //Pasar el texto a int para poder trabajar con el operando1 = double.Parse(Pantalla.Text); // Borramos lo que hay en pantalla Pantalla.DeleteText(0, Pantalla.Text.Length); } }
protected void OnNueveClicked(object sender, EventArgs e) { if (cont_igual == 1) { Pantalla.DeleteText(0, Pantalla.Text.Length); cont_punto = 0; } cont_igual = 0; String display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(display + "9"); }
protected void OnBIgualClicked(object sender, EventArgs e) { num2 = Convert.ToSingle(Pantalla.Text); Pantalla.DeleteText(0, Pantalla.Text.Length); contador = 0; switch (opcion) { case 1: result = operacion.suma(num1, num2); Pantalla.InsertText(Convert.ToString(result)); contador1++; if (result >= 1) { break; } break; case 2: result = operacion.resta(num1, num2); Pantalla.InsertText(Convert.ToString(result)); contador1++; if (result >= 1) { break; } break; case 3: result = operacion.producto(num1, num2); Pantalla.InsertText(Convert.ToString(result)); contador1++; if (result >= 1) { break; } break; case 4: result = operacion.cociente(num1, num2); Pantalla.InsertText(Convert.ToString(result)); contador1++; if (result >= 1) { break; } break; } }
protected void OnClicked2(object sender, EventArgs e) { if (res) { Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText("2"); res = false; } else { String Display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(Display + "2"); } }
//cinco protected void OnBcincoClicked(object sender, EventArgs e) { if (contadorigual == 1) { Pantalla.DeleteText(0, Pantalla.Text.Length); } contadorpunto = 0; contadorigual = 0; String display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(display + "5"); }
protected void OnBPuntoClicked(object sender, EventArgs e) { if (flag == 0) { String Display = Pantalla.Text.ToString(); if (Display.Contains(",") == false) { if (Display.Equals("")) { Pantalla.InsertText("0,"); } else { Pantalla.DeleteText(0, Pantalla.Text.Length); Pantalla.InsertText(Display + ","); } } } }
//RESULTADO protected void OnCigualClicked(object sender, EventArgs e) { num2 = Convert.ToSingle(Pantalla.Text); Pantalla.DeleteText(0, Pantalla.Text.Length); if (contador_igual == 0) { switch (opcion) { case 1: resultado = resultados.suma(num1, num2); Pantalla.InsertText(Convert.ToString(resultado)); contador_igual++; break; case 2: resultado = resultados.resta(num1, num2); Pantalla.InsertText(Convert.ToString(resultado)); contador_igual++; break; case 3: resultado = resultados.multiplicacion(num1, num2); Pantalla.InsertText(Convert.ToString(resultado)); contador_igual++; break; case 4: resultado = resultados.division(num1, num2); Pantalla.InsertText(Convert.ToString(resultado)); contador_igual++; break; } } else { Pantalla.InsertText("↡Vacía para continuar↡"); contador_igual++; } }
//boton igual protected void OnBigualClicked(object sender, EventArgs e) { numero2 = Convert.ToSingle(Pantalla.Text); String display = Pantalla.Text.ToString(); Pantalla.DeleteText(0, Pantalla.Text.Length); switch (opcion) { case "+": result = resultado.suma(numero1, numero2); this.Pantalla.Text = (Convert.ToString(result)); contadorigual++; break; case "-": result = resultado.resta(numero1, numero2); this.Pantalla.Text = (Convert.ToString(result)); contadorigual++; break; case "*": result = resultado.multiplicacion(numero1, numero2); this.Pantalla.Text = (Convert.ToString(result)); contadorigual++; break; case "/": result = resultado.division(numero1, numero2); this.Pantalla.Text = (Convert.ToString(result)); contadorigual++; break; } }
protected void OnBVaciarClicked(object sender, EventArgs e) { Pantalla.DeleteText(0, Pantalla.Text.Length); flag = 0; }
protected void OnBarraClicked(object sender, EventArgs e) { valor_a = Convert.ToDouble(Pantalla.Text); Pantalla.DeleteText(0, Pantalla.Text.Length); signo = "/"; }
//Boton vaciar protected void OnBvaciarClicked(object sender, EventArgs e) { Pantalla.DeleteText(0, Pantalla.Text.Length); contadorpunto = 0; }