/// <summary> /// ACCION QUE AGREGA UN CLIENTE /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnAgregar_Click(object sender, EventArgs e) { //SE INFLA LA VISTA CON EL LAYOUT DETALLE DE LIBRO View view = LayoutInflater.Inflate(Resource.Layout.CustomerAdd, null); //SE CREA EL POP UP DEL LIBRO Android.App.AlertDialog builder = new Android.App.AlertDialog.Builder((Activity)rootView.Context) .SetTitle("Agregar cliente") .SetIcon(Android.Resource.Drawable.IcDialogInfo).Create(); //ASIGNACION DE TEXTOS :v edtCode = view.FindViewById <EditText>(Resource.Id.editText1); EditText edtName = view.FindViewById <EditText>(Resource.Id.editText2); EditText edtLastName = view.FindViewById <EditText>(Resource.Id.editText3); ImageButton b = view.FindViewById <ImageButton>(Resource.Id.imageButton1); #pragma warning disable CS0618 // El tipo o el miembro están obsoletos b.SetBackgroundDrawable(null); #pragma warning restore CS0618 // El tipo o el miembro están obsoletos b.Click += async delegate { //Tell our scanner to use the default overlay scanner.UseCustomOverlay = false; //PERSONALIZAR LOS MENSAJES QUE SE MOSTRARAN EN LA CAMARA DEL SCANNER scanner.TopText = "Por favor, no mueva el dispositivo móvil\nMantengalo al menos 10cm de distancia"; scanner.BottomText = "Espere mientras el scanner lee el código de barra"; //COMIENZO DEL SCANEO var result = await scanner.Scan(); HandleScanResult(result); }; view.FindViewById <Button>(Resource.Id.button1).Click += delegate { if (edtCode.Text != "" && edtName.Text != "" && edtLastName.Text != "") { var save = Service.AddCustomer(edtName.Text, edtLastName.Text, edtCode.Text); if (save.band) { edtCedula.Text = edtCode.Text; edtNombres.Text = edtName.Text + " " + edtLastName.Text; //BUSCAR EL CLIENTE PARA SU ID idCliente = Service.GetCustomerData(edtCode.Text).Id; Toast.MakeText(rootView.Context, save.message, ToastLength.Long).Show(); //CERRAR EL DIALOG builder.Dismiss(); } else { Toast.MakeText(rootView.Context, save.message, ToastLength.Long).Show(); } } else { Toast.MakeText(rootView.Context, "Llene los campos importantes", ToastLength.Long).Show(); } }; builder.SetView(view); builder.Show(); }