Example #1
0
 private void BtnCalcular_Click(object sender, EventArgs e)
 {
     lblError.Text = "";
     indice        = (int)numericUpDownIndice.Value;
     if (INumeroComplejo.Equals(radicando, null) || indice <= 0)
     {
         if (INumeroComplejo.Equals(radicando, null))
         {
             lblError.Text = "Ingrese un número complejo válido";
         }
         if (indice <= 0)
         {
             lblError.Text += "ingrese un indice positivo";
         }
         return;
     }
     else
     {
         listBoxResultados.Items.Clear();
         foreach (INumeroComplejo item in OperacionesService.Radicacion(radicando, indice))
         {
             listBoxResultados.Items.Add(item.Show());//
         }
     }
 }
 private void BtnCalcular_Click(object sender, EventArgs e)
 {
     if (INumeroComplejo.Equals(numeroComplejo, null))
     {
         lblResultado.Text = "Ingrese un número complejo válido";
     }
     else
     {
         lblResultado.Text = OperacionesService.Potenciacion(numeroComplejo, (int)numericUpDownExponente.Value).Show();
     }
 }
Example #3
0
        private void CalcularButton_Click(object sender, EventArgs e)
        {
            if (INumeroComplejo.Equals(operando1, null) || INumeroComplejo.Equals(operando2, null))
            {
                resultadoLabel.Text = "Falta asignar algun operando, asignelo y vuelva a intentar";
            }
            else
            {
                if (SumaButton.Checked)
                {
                    //logica de la suma. en lo posible delegar todas las cuentas a un servicio asi queda limpia esta parte del codigo ?
                    resultado = OperacionesService.Sumar(operando1, operando2);
                }
                if (RestaButton.Checked)
                {
                    //resta
                    resultado = OperacionesService.Resta(operando1, operando2);
                }
                if (MultiplicacionButton.Checked)
                {
                    //multiplicacion
                    resultado = OperacionesService.Multiplicar(operando1, operando2);
                }
                if (DivisionButton.Checked)
                {
                    if (operando2.GetFormaPolar().GetModulo() != 0)
                    {
                        resultado = OperacionesService.Dividir(operando1, operando2);
                    }
                    else
                    {
                        resultadoLabel.Text = "No es posible dividir por cero";
                        return;
                    }
                }

                resultadoLabel.Text = resultado.Show();
            }
        }