private async Task SelectPicture() { Setup(); ImageSource = null; _imgstream = null; try { var mediaFile = await _mediaPicker.SelectPhotoAsync(new CameraMediaStorageOptions { DefaultCamera = CameraDevice.Rear, MaxPixelDimension = 400, SaveMediaOnCapture = true }); MemoryStream ms = new MemoryStream(); mediaFile.Source.CopyTo(ms); _imgstream = ms.ToArray(); ImageSource = ImageSource.FromStream(() => mediaFile.Source); } catch (System.Exception ex) { Status = ex.Message; } }
/// <summary> /// Selects the picture. /// </summary> /// <returns>Select Picture Task.</returns> private async Task SelectPicture() { Setup(); ImageSource = null; try { var mediaFile = await _mediaPicker.SelectPhotoAsync(new CameraMediaStorageOptions { DefaultCamera = CameraDevice.Front, MaxPixelDimension = 400 }); ImageSource = ImageSource.FromStream(() => mediaFile.Source); } catch (System.Exception ex) { Status = ex.Message; } }