private async void PickPhotoCommandExecute() { try { var action = await DisplayPictureAlert(); var pictureService = Xamarin.Forms.DependencyService.Get <PictureService>(); var file = await pictureService.GetPicture(action); if (file != null) { using (var memoryStream = new MemoryStream()) { file.GetStream().CopyTo(memoryStream); file.Dispose(); PetImages.Add(new PetPictureItem { Id = Guid.NewGuid().ToString(), Image = memoryStream.ToArray() }); CreatePosterCommand.RaiseCanExecuteChanged(); } } } catch (Exception ex) { await _dialogService.DisplayAlertAsync("Erro", ex.Message, "Fechar"); } }
private void DeletePetPictureCommandExecute(string imageId) { PetImages.Remove(PetImages.Single(w => w.Id == imageId)); CreatePosterCommand.RaiseCanExecuteChanged(); }