Пример #1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            // return inflater.Inflate(Resource.Layout.YourFragment, container, false);
            //return base.OnCreateView(inflater, container, savedInstanceState);

            rootView = inflater.Inflate(Resource.Layout.fragmentrental, container, false);
            //INICIALIZAR LOS OBJETOS
            MobileBarcodeScanner.Initialize(Activity.Application);

            scanner = new MobileBarcodeScanner();

            edtCedula    = rootView.FindViewById <EditText>(Resource.Id.editText1);
            edtNombres   = rootView.FindViewById <EditText>(Resource.Id.editText2);
            edtCodAlq    = rootView.FindViewById <EditText>(Resource.Id.editText3);
            edtFechaalq  = rootView.FindViewById <EditText>(Resource.Id.editText4);
            edtFechaDevo = rootView.FindViewById <EditText>(Resource.Id.editText5);

            //DESACTIVAR LOS EDITEXT DE FECHA Y OTROS
            edtFechaalq.Enabled  = false;
            edtFechaDevo.Enabled = false;
            edtCodAlq.Enabled    = false;
            edtNombres.Enabled   = false;

            edtCodAlq.Text   = (Service.RentalCode());
            edtFechaalq.Text = DateTime.Now.ToShortDateString();

            //ASIGNACION DE OBJETOS Y ELIMINACION DE FONDOS A IMAGEBOTTON
            btnScan = rootView.FindViewById <ImageButton>(Resource.Id.button1);
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            btnScan.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            btnAgregar = rootView.FindViewById <ImageButton>(Resource.Id.button2);
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            btnAgregar.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            btnFecha = rootView.FindViewById <ImageButton>(Resource.Id.button3);
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            btnFecha.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            btnlibros = rootView.FindViewById <ImageButton>(Resource.Id.button4);
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            btnlibros.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            btnguardar = rootView.FindViewById <ImageButton>(Resource.Id.button5);
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            btnguardar.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos
            btnAceptar = rootView.FindViewById <ImageButton>(Resource.Id.button6);
#pragma warning disable CS0618 // El tipo o el miembro están obsoletos
            btnAceptar.SetBackgroundDrawable(null);
#pragma warning restore CS0618 // El tipo o el miembro están obsoletos

            listacopias = rootView.FindViewById <ListView>(Resource.Id.listView1);

            btnlibros.Click  += Btnlibros_Click;
            btnFecha.Click   += BtnFecha_Click;
            btnAgregar.Click += BtnAgregar_Click;
            btnguardar.Click += Btnguardar_Click;
            btnAceptar.Click += BtnAceptar_Click;

            //ACTIVA EL ESCANEO
            btnScan.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);
            };

            return(rootView);
        }