示例#1
0
        private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
        {
            if (!result.Success)
            {
                return;
            }
            Photo photo1 = new Photo();

            photo1.Base64 = Convert.ToBase64String(result.Result);
            countPhoto++;
            if (cameraStrapAndTrackMV.Car.GetIndexCar(countPhoto) == 0)
            {
                photo1.path = $"../Photo/{cameraStrapAndTrackMV.VehiclwInformation.Id}/PikedUp/CameraSeatBelts/{countPhoto}.jpg";
                cameraStrapAndTrackMV.straps.Add(photo1);
                cameraStrapAndTrackMV.SavePhotoInTruck();
                return;
            }
            else if (cameraStrapAndTrackMV.Car.GetIndexCar(countPhoto) > 0)
            {
                photo1.path = $"../Photo/{cameraStrapAndTrackMV.VehiclwInformation.Id}/PikedUp/CameraTrack/{countPhoto}.jpg";
                if (cameraStrapAndTrackMV.Car.GetIndexCar(countPhoto) > cameraStrapAndTrackMV.Car.CountCarImg)
                {
                    cameraStrapAndTrackMV.straps.Add(photo1);
                }
                else
                {
                    cameraStrapAndTrackMV.inTruck.Add(photo1);
                }
                paternPhoto.Source = $"{cameraStrapAndTrackMV.Car.TypeIndex.Replace(" ", "")}{cameraStrapAndTrackMV.Car.GetIndexCar(countPhoto)}.png";
                titlePhoto.Text    = cameraStrapAndTrackMV.Car.GetNameLayout(cameraStrapAndTrackMV.Car.GetIndexCar(countPhoto));
            }
        }
        private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
        {
            if (!result.Success)
            {
                return;
            }
            Photo photo1 = new Photo();

            photo1.Base64 = Convert.ToBase64String(result.Result);
            photo1.path   = $"../Photo/{ask1Page.ask1PageMV.VehiclwInformation.Id}/PikedUp/CameraTrack/{photos.Count + 1}.jpg";
            photos.Add(photo1);
            imagesByte.Add(result.Result);
            countPhoto++;
            if (car.GetIndexCar(countPhoto) == 0)
            {
                await Navigation.PopAsync(true);

                //ask1Page.AddPhotoInTrack(photos, imagesByte);
                DependencyService.Get <IOrientationHandler>().ForceSensor();
                return;
            }
            else
            {
                car.OrintableScreen(car.GetIndexCar(countPhoto));
                paternPhoto.Source = $"{car.TypeIndex.Replace(" ", "")}{car.GetIndexCar(countPhoto)}.png";
                titlePhoto.Text    = car.GetNameLayout(car.GetIndexCar(countPhoto));
            }
        }
 private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
 {
     if (!result.Success)
     {
         return;
     }
     await fullPhotoTruckVM.AddPhoto(result.Result);
 }
示例#4
0
 private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
 {
     if (!result.Success)
     {
         return;
     }
     askPageDelyvery.AddPhoto(result.Result);
     await Navigation.PopAsync(true);
 }
示例#5
0
 private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
 {
     if (!result.Success)
     {
         return;
     }
     ask2Page.AddPhotoDocumments(result.Result);
     await Navigation.PopAsync();
 }
 private async void CameraPage_OnScan(PhotoResultEventArgs result)
 {
     if (!result.Success)
     {
         return;
     }
     settingsMV.DetectText(result.Result, typeDetect);
     DependencyService.Get <IOrientationHandler>().ForceSensor();
     await Navigation.PopModalAsync();
 }
        private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
        {
            await Navigation.PopAsync();

            if (!result.Success)
            {
                return;
            }
            retake.SetRetakePhoto(result.Result);
        }
示例#8
0
        async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
        {
            await Navigation.PopModalAsync();

            if (!result.Success)
            {
                return;
            }

            Photo.Source = ImageSource.FromStream(() => new MemoryStream(result.Image));

            AppState._instance.lastphoto = ImageSource.FromStream(() => new MemoryStream(result.Image));
            int a = 1;
        }
 private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
 {
     if (!result.Success)
     {
         return;
     }
     fullPagePhotoDelyvery.fullPagePhotoDelyveryMV.AddNewFotoSourse(result.Result);
     fullPagePhotoDelyvery.fullPagePhotoDelyveryMV.SetPhoto(result.Result);
     fullPagePhotoDelyvery.SetbtnVisable();
     if (pageAddDamage1 != null)
     {
         pageAddDamage1.stateSelect = 0;
     }
     await Navigation.PopAsync(true);
 }
        private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
        {
            if (!result.Success)
            {
                return;
            }
            await fullPagePhoto.fullPagePhotoMV.AddNewFotoSourse(result.Result);

            await fullPagePhoto.fullPagePhotoMV.SetPhoto(result.Result, result.Width, result.Height);

            await fullPagePhoto.SetbtnVisable();

            if (pageAddDamage != null)
            {
                pageAddDamage.stateSelect = 0;
            }
            await Navigation.PopAsync(true);
        }
示例#11
0
 private async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
 {
     //if (!result.Success)
     //    return;
     //if(photos.Count >= 3)
     //{
     //    await Navigation.PopAsync(true);
     //    Photo photo1 = new Photo();
     //    photo1.Base64 = Convert.ToBase64String(result.Result);
     //    photo1.path = $"../Photo/{ask1Page.ask1PageMV.VehiclwInformation.Id}/PikedUp/CameraSeatBelts/{photos.Count + 1}.jpg";
     //    photos.Add(photo1);
     //    imagesByte.Add(result.Result);
     //    ask1Page.AddPhotoSeatBelts(photos, imagesByte);
     //    return;
     //}
     //Photo photo = new Photo();
     //photo.Base64 = Convert.ToBase64String(result.Result);
     //photo.path = $"../Photo/{ask1Page.ask1PageMV.VehiclwInformation.Id}/PikedUp/CameraSeatBelts/{photos.Count + 1}.jpg";
     //photos.Add(photo);
     //imagesByte.Add(result.Result);
     //titlePhoto.Text = $"{photos.Count + 1}";
 }
示例#12
0
        /// <summary>
        /// evento del boton capturar, hace una llamada a la pantalla camara (se renderiza nativamente según el dispositivo)
        /// cualquier cambio a la camara es necesaria hacerla en CamaraPageRenderer.cs contenido en el modulo de .droid y .iOS respectivamente
        /// </summary>
        /// <param name="sender">objeto que hace referencia al evento</param>
        /// <param name="e">argumentos que son posibles de obtener apartir del objeto que hace llamada al evento</param>
        private async void TakePicture(PhotoResultEventArgs result)
        {
            await Navigation.PopModalAsync();

            if (!result.Success)
            {
                return;
            }


            bool match = false;



            var cont = 0;

            indicador.IsRunning = true;
            string calle = "", domicilio = "", texto = "";

            //var hasTwoNames = false;
            if (CrossConnectivity.Current.IsConnected)
            {
                try
                {
                    var ocr = await GetTextDescription(new MemoryStream(result.Image));


                    foreach (var region in ocr.Regions)
                    {
                        foreach (var line in region.Lines)
                        {
                            var lineStack = new StackLayout
                            {
                                Orientation = StackOrientation.Horizontal
                            };


                            foreach (var words in line.Words)
                            {
                                if (words.Text.Equals("DOMICILIO"))
                                {
                                    match = true;
                                    break;
                                }

                                if (cont == 1)
                                {
                                    calle = calle + words.Text + "%";
                                    //match = false;
                                }
                                if (cont == 2)
                                {
                                    domicilio = domicilio + words.Text + "#";
                                }

                                texto = texto + words.Text;
                            }
                            if (match)
                            {
                                cont++;
                            }
                        }
                    }


                    try
                    {
                        String[] callex = calle.Split('%');

                        String[] domiciliox = domicilio.Split('#');

                        System.Diagnostics.Debug.WriteLine(callex[callex.Length - 2] + " " + callex[1] + " " + callex[2] + " #" + callex.Length);
                        System.Diagnostics.Debug.WriteLine(domicilio);
                        System.Diagnostics.Debug.WriteLine(texto);
                        enDomicilio.Text = callex[1];
                        enNumero.Text    = callex[callex.Length - 2];
                        for (int i = 1; i < domiciliox.Length - 2; i++)
                        {
                            enColonia.Text = enColonia.Text + domiciliox[i] + "\t";
                        }


                        enCod.Text = domiciliox[domiciliox.Length - 2];
                    }
                    catch (IndexOutOfRangeException)
                    {
                        await DisplayAlert("Error", "No Fué posible capturar los campos", "OK");
                    }
                }
                catch (ClientException ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
                //System.Diagnostics.Debug.WriteLine(texto);
                indicador.IsRunning = false;
            }
            else
            {
                await DisplayAlert("Error de conexión", "Es necesario estar conectado a internet para acceder este servicio", "Ok");
            }
        }
 public UploadPage(PhotoResultEventArgs photoResult)
 {
     InitializeComponent();
     this.photoResult = photoResult;
     BindingContext   = viewModel = SimpleIoc.Default.GetInstance <CameraViewModel>();
 }
示例#14
0
 private void CstmList_OnOnItemSelected(object sender, PhotoResultEventArgs e)
 {
 }
示例#15
0
        /// <summary>
        /// obtiene la imagen capturada apartir de la foto que el usuario tomó hace una instancia al metodo GetTextDescription
        /// mismo que obtiene un resultado de texto apartir de la imagen enviada (en este caso adaptado para IFE/INE)
        /// la variable OCR contiene una coleccion de texto dividio en regiones, lineas y palabras mismos que son recorridos
        /// para obtener texto especifico dentro del resultado y llenar los campos de entrada
        /// </summary>
        /// <param name="result">Imagen resultante al tomar la foto</param>
        async void CameraPage_OnPhotoResult(PhotoResultEventArgs result)
        {
            await Navigation.PopModalAsync();

            if (!result.Success)
            {
                return;
            }

            //Photo.Source = ImageSource.FromStream(() => new MemoryStream(result.Image));



            bool match = false, match2 = false, gender = false, respaldo = false;
            int  cont = 0, cont2 = 0, respcont = 0;
            var  nombre  = "";
            var  genero  = "";
            var  respnom = new string[2];



            indicador.IsRunning = true;
            string texto = "", CURP = "";
            bool   hasTwoNames = false, respTwoNames = false;
            var    fecha = "";
            string calle = "", domicilio = "";

            try
            {
                var ocr = await GetTextDescription(new MemoryStream(result.Image));



                foreach (var region in ocr.Regions)
                {
                    foreach (var line in region.Lines)
                    {
                        var lineStack = new StackLayout
                        {
                            Orientation = StackOrientation.Horizontal
                        };


                        foreach (var words in line.Words)
                        {
                            texto = texto + words.Text + "\n";
                            if (words.Text.Equals("NOMBRE"))
                            {
                                texto = words.Text;
                                match = true;
                                break;
                            }

                            if (match && cont < 4)
                            {
                                if (line.Words.Length > 1 && cont == 3)
                                {
                                    hasTwoNames = true;
                                    System.Diagnostics.Debug.WriteLine("tiene dos nombres");
                                }
                                else
                                {
                                    System.Diagnostics.Debug.WriteLine("tiene un nombre");
                                }
                                nombre += words.Text + "#";

                                cont++;
                            }
                            if (words.Text.Equals("SEXO"))
                            {
                                gender = true;
                            }
                            if (gender && (words.Text.Equals("M") || words.Text.Equals("H")))
                            {
                                genero   = words.Text;
                                gender   = false;
                                respaldo = true;
                                break;
                            }

                            if (respaldo && respcont < 2)
                            {
                                if (line.Words.Length > 1)
                                {
                                    respTwoNames      = true;
                                    respnom[respcont] = words.Text;
                                    respcont++;
                                }
                                else
                                {
                                    respnom[0] = words.Text;
                                    respcont   = 2;
                                }
                            }
                            if (words.Text.Length == 18)
                            {
                                CURP = words.Text;

                                System.Diagnostics.Debug.WriteLine(CURP.Substring(4, 6));
                                fecha = CURP.Substring(8, 2) + "/" + CURP.Substring(6, 2) + "/" + "19" + CURP.Substring(4, 2);
                            }
                            // texto = texto + words.Text +"\n";

                            if (words.Text.Equals("DOMICILIO"))
                            {
                                match2 = true;
                                break;
                            }

                            if (cont2 == 1)
                            {
                                calle = calle + words.Text + "%";
                                //match = false;
                            }
                            if (cont2 == 2)
                            {
                                domicilio = domicilio + words.Text + "#";
                            }
                        }
                        if (match2)
                        {
                            cont2++;
                        }
                    }
                }
                String[] nombrex = nombre.Split('#');
                System.Diagnostics.Debug.WriteLine(texto);
                try
                {
                    enCURP.Text = CURP;

                    enPaterno.Text = nombrex[0];
                    enMaterno.Text = nombrex[1];
                    if (!nombre.Contains("INSTI"))
                    {
                        enNombre.Text = nombrex[2];
                        if (hasTwoNames)
                        {
                            enNombre.Text = nombrex[2] + "\t" + nombrex[3];
                        }
                    }
                    else
                    {
                        if (respTwoNames)
                        {
                            enNombre.Text = respnom[0] + "\t" + respnom[1];
                        }
                        else
                        {
                            enNombre.Text = respnom[0];
                        }
                    }

                    String[] callex = calle.Split('%');

                    String[] domiciliox = domicilio.Split('#');

                    //quite la abreviatura del inicio
                    dire.calle  = callex[1];
                    dire.numero = callex[callex.Length - 2];
                    //cambie el inicio del vector para que omita el tipo de asentamineto
                    for (int i = 1; i < domiciliox.Length - 2; i++)
                    {
                        catDir.asentamiento = catDir.asentamiento + domiciliox[i] + "\t";
                    }


                    catDir.cp = domiciliox[domiciliox.Length - 2];
                }
                catch (IndexOutOfRangeException)
                {
                    await DisplayAlert("Advertencia", "No fue posible capturar algunos campos", "OK");

                    System.Diagnostics.Debug.WriteLine(texto);
                }
                try
                {
                    System.Diagnostics.Debug.WriteLine(fecha);
                    dtFecha.Date = DateTime.ParseExact(fecha, "dd/MM/yyyy", null);
                }
                catch (Exception e)
                {
                    await DisplayAlert("Fallo de captura", "No fue posible capturar la fecha", "Ok");

                    System.Diagnostics.Debug.WriteLine(e.Message);
                }
                if (genero.Equals("M"))
                {
                    pkSexo.SelectedIndex = 1;
                }
                else
                {
                    pkSexo.SelectedIndex = 0;
                }
            }
            catch (ClientException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
            }
            //System.Diagnostics.Debug.WriteLine(texto);
            indicador.IsRunning = false;
        }