Example #1
0
        private async void BotonActualizar_Click(object sender, EventArgs e)
        {
            progress = new Android.App.ProgressDialog(this.Context);
            progress.Indeterminate = true;
            progress.SetProgressStyle(Android.App.ProgressDialogStyle.Spinner);
            progress.SetMessage("Actualizando...Espere...");
            progress.SetCancelable(false);
            progress.Show();

            string dni    = txtdni.Text;
            string nombre = txtnombre.Text;
            string email  = txtEmail.Text;
            string telef  = txtTele_F.Text;
            string telec  = txtTele_C.Text;

            if (!string.IsNullOrEmpty(dni) || !string.IsNullOrEmpty(nombre) || !string.IsNullOrEmpty(email) || !string.IsNullOrEmpty(telef) || !string.IsNullOrEmpty(telec))
            {
                //await
                var dato = await controller.ActualizaCliente(int.Parse(dni), nombre, email, int.Parse(telef), int.Parse(telec));

                if (dato != null)
                {
                    progress.Dismiss();
                    Toast.MakeText(this.Context, "Actualizado Correctamente", ToastLength.Short).Show();
                    LimpiarCasillas();
                }
                else
                {
                    progress.Dismiss();
                    Toast.MakeText(this.Context, "Error al Actualizar", ToastLength.Short).Show();
                    LimpiarCasillas();
                }
            }
            else
            {
                progress.Dismiss();
                Toast.MakeText(this.Context, "Campos vacios", ToastLength.Short).Show();
            }
        }