Exemplo n.º 1
0
        public static void MostrarError(string error, string mensaje)
        {
            Procesando.Error   = error;
            Procesando.Mensaje = mensaje;
            Thread.Sleep(3000);

            Procesando.Invoke((Action)(() => Procesando.Hide()));
        }
Exemplo n.º 2
0
        private void teclado_OnUserControlButtonClicked(object sender, EventArgs e)
        {
            Button b = (Button)sender;

            if (tbCodigo != null)
            {
                switch (b.Text)
                {
                case "Borrar":
                    if (tbCodigo.Text.Length > 1)
                    {
                        tbCodigo.Text = tbCodigo.Text.Substring(0, tbCodigo.Text.Length - 1);
                    }
                    else
                    {
                        tbCodigo.Text = string.Empty;
                    }
                    break;

                case "Entrar":
                    try
                    {
                        PeticionParaComprobarProductor peticion = new PeticionParaComprobarProductor()
                        {
                            Codigo = int.Parse(tbCodigo.Text), Linea = 1
                        };
                        Procesando.Limpiar();
                        Procesando.Show();
                        AsyncCallback callback = new AsyncCallback(CallbackComprobarProductor);
                        IAsyncResult  ar       = servicios.BeginComprobarProductor(peticion, callback, null);
                    }
                    catch
                    {
                    }

                    break;


                default:
                    if (tbCodigo.Text.Length < 5)
                    {
                        tbCodigo.Text += b.Text;
                    }

                    break;
                }
            }
        }
Exemplo n.º 3
0
 private void CallbackComprobarProductor(IAsyncResult ar)
 {
     try
     {
         RespuestaDeComprobarProductor respuesta = servicios.EndComprobarProductor(ar);
         if (respuesta.Existe)
         {
             Seleccionando.Datos = respuesta;
             Seleccionando.Invoke((Action)(() => Seleccionando.Show()));
             Procesando.Invoke((Action)(() => Procesando.Hide()));
         }
         else
         {
             MostrarError("Productor no encontrado.", "El código proporcionado no se encuentra registrado.");
         }
     }
     catch (WebException e)
     {
         MostrarError("Servidor no conectado.", e.Message);
         tbCodigo.Invoke((Action)(() => tbCodigo.Text = ""));
     }
 }