Exemple #1
0
        private async void TakePictureButton_Clicked(object sender, EventArgs e)
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                await DisplayAlert("No Camera", "No camera available.", "OK");

                return;
            }

            file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
            {
                SaveToAlbum = true,
                Name        = "test.jpg"
            });

            if (file == null)
            {
                return;
            }

            ShowActivityIndicator(true);

            // Upload image to azure blob storage
            azureImage = await AzureStorage.UploadImage(file);

            Image1.Source       = ImageSource.FromStream(() => file.GetStream());
            this.BindingContext = await DetectFaceAndEmotionsAsync(azureImage.StorageUri);

            AddFaceButton.IsEnabled = true;
            ShowActivityIndicator(false);
        }
Exemple #2
0
        private async void TakePictureButton_Clicked(object sender, EventArgs e)
        {
            await CrossMedia.Current.Initialize();

            if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
            {
                await DisplayAlert("No Camera", "No camera available.", "OK");

                return;
            }

            file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
            {
                SaveToAlbum = true,
                Name        = "test.jpg"
            });

            if (file == null)
            {
                return;
            }

            // Upload image to azure blob storage
            azureImage = await AzureStorage.UploadImage(file);
        }