private async void loadCamera(object sender, EventArgs e)
        {
            await CrossMedia.Current.Initialize();

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

                return;
            }

            MediaFile file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
            {
                PhotoSize = PhotoSize.Medium,
                Directory = "Sample",
                Name      = $"{DateTime.UtcNow}.jpg"
            });

            if (file == null)
            {
                return;
            }

            image.Source = ImageSource.FromStream(() =>
            {
                return(file.GetStream());
            });
            await postLocationAsync();

            async Task postLocationAsync()
            {
                var locator = CrossGeolocator.Current;

                locator.DesiredAccuracy = 50;

                var position = await locator.GetPositionAsync();

                NotHeroModel model = new NotHeroModel()
                {
                    Longitude = (float)position.Longitude,
                    Latitude  = (float)position.Latitude
                };

                await AzureManager.AzureManagerInstance.PostHeroInformation(model);
            }

            await MakePredictionRequest(file);
        }
Beispiel #2
0
 public async Task DeleteHeroInformation(NotHeroModel notHeroModel)
 {
     await this.notHeroTable.DeleteAsync(notHeroModel);
 }
Beispiel #3
0
 public async Task PostHeroInformation(NotHeroModel notHeroModel)
 {
     await this.notHeroTable.InsertAsync(notHeroModel);
 }