private async void TomarFoto(System.Windows.Controls.Image Picture) { try { if (Processing) { return; } Processing = true; ImagesToSave = ImagesToSave ?? new List <ImageSourceToSave>(); if (CamaraWeb.ImageControls.Where(w => w.Name == Picture.Name).Any()) { Picture.Source = CamaraWeb.TomarFoto(Picture); ImagesToSave.Add(new ImageSourceToSave { FrameName = Picture.Name, ImageCaptured = (System.Windows.Media.Imaging.BitmapSource)Picture.Source }); StaticSourcesViewModel.Mensaje(Picture.Name.Contains("ImgFrente") ? "FOTO DE FRENTE" : Picture.Name.Contains("ImgReverso") ? "FOTO TRASERA" : "FOTO", "Foto Capturada", StaticSourcesViewModel.enumTipoMensaje.MENSAJE_INFORMACION, 1); } else { if (await new Dialogos().ConfirmarEliminar("ADVERTENCIA!", "ESTA SEGÚRO QUE DESEA CAMBIAR LA FOTO " + (Picture.Name.Contains("ImgFrente") ? "FOTO DE FRENTE" : Picture.Name.Contains("ImgReverso") ? "FOTO TRASERA" : "") + "?") == 1) { CamaraWeb.QuitarFoto(Picture); ImagesToSave.Remove(ImagesToSave.Where(wm => wm.FrameName == Picture.Name).SingleOrDefault()); } } Processing = false; } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al tomar la foto.", ex); } }
private async void OnTakePicture(System.Windows.Controls.Image Picture) { try { if (Processing) { return; } Processing = true; ImageFrontal = ImageFrontal ?? new List <ImageSourceToSave>(); if (CamaraWeb.ImageControls.Where(w => w.Name == Picture.Name).Any()) { Picture.Source = CamaraWeb.TomarFoto(Picture); ImageFrontal = new List <ImageSourceToSave>(); ImageFrontal.Add(new ImageSourceToSave { FrameName = Picture.Name, ImageCaptured = (BitmapSource)Picture.Source }); StaticSourcesViewModel.Mensaje("Foto de Frente", "Foto Capturada", StaticSourcesViewModel.enumTipoMensaje.MENSAJE_INFORMACION, 1); } else { if (await new Dialogos().ConfirmarEliminar("Advertencia", "Esta segúro que desea cambiar la foto " + (Picture.Name.Contains("ImgFrente") ? "foto de frente" : Picture.Name.Contains("ImgReverso") ? "foto trasera" : "") + "?") == 1) { CamaraWeb.QuitarFoto(Picture); //ImageFrontal.Remove(ImagesToSave.Where(wm => wm.FrameName == Picture.Name).SingleOrDefault()); ImageFrontal = new List <ImageSourceToSave>(); } } if (ImageFrontal != null ? ImageFrontal.Count == 1 : false) { BotonTomarFotoEnabled = true; } else { BotonTomarFotoEnabled = false; } Processing = false; } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al tomar la foto.", ex); } }
private void OnTakePicture(System.Windows.Controls.Image Picture) { try { if (Processing) { return; } Processing = true; ImageFrontal = ImageFrontal ?? new List <ImageSourceToSave>(); if (CamaraWeb.ImageControls.Where(w => w.Name == Picture.Name).Any()) { Picture.Source = CamaraWeb.TomarFoto(Picture); ImageFrontal.Add(new ImageSourceToSave { FrameName = Picture.Name, ImageCaptured = (System.Windows.Media.Imaging.BitmapSource)Picture.Source }); StaticSourcesViewModel.Mensaje("FOTO DE FRENTE", "Foto Capturada", StaticSourcesViewModel.enumTipoMensaje.MENSAJE_INFORMACION, 1); } else { CamaraWeb.QuitarFoto(Picture); ImageFrontal.Remove(ImageFrontal.Where(wm => wm.FrameName == Picture.Name).SingleOrDefault()); } if (ImageFrontal != null ? ImageFrontal.Count == 1 : false) { BotonTomarFotoEnabled = true; } else { BotonTomarFotoEnabled = false; } Processing = false; } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al tomar la foto.", ex); } }