コード例 #1
0
        private async Task CapturePhoto()
        {
            var lowLagCapture = await _mediaCapture.PrepareLowLagPhotoCaptureAsync(ImageEncodingProperties.CreateJpeg());

            var capturedPhoto = await lowLagCapture.CaptureAsync();

            var softwareBitmap = capturedPhoto.Frame.AsStream();

            CapturePhotoService.ImageCaptureHandler(Xamarin.Forms.ImageSource.FromStream(() => softwareBitmap));

            await lowLagCapture.FinishAsync();
        }
コード例 #2
0
        private async void OnCameraViewTapped(object sender, EventArgs e)
        {
            if (_uiCameraView.IsPreviewing)
            {
                var imageData = await CapturePhoto();


                CapturePhotoService.ImageCaptureHandler(ImageSource.FromStream(() => new MemoryStream(imageData)));

                SetNeedsDisplay();

                _uiCameraView.CaptureSession.StopRunning();
                _uiCameraView.IsPreviewing = false;
            }
            else
            {
                _uiCameraView.CaptureSession.StartRunning();
                _uiCameraView.IsPreviewing = true;
            }
        }
コード例 #3
0
 private static void OnPhoto(object sender, ImageSource imageData)
 {
     Device.BeginInvokeOnMainThread(() => { CapturePhotoService.ImageCaptureHandler(imageData); });
 }