Ejemplo n.º 1
0
        private async void Submit()
        {
            IsBusy = true;

            try
            {
                if (ImageFile != null)
                {
                    var locator = CrossGeolocator.Current;
                    locator.DesiredAccuracy = 50;
                    Position position = await locator.GetPositionAsync(timeoutMilliseconds : 10000);

                    byte[] resizedImage = await _imageService.CompressImageAsync(GetByteArray(ImageFile.GetStream()));

                    _response = await _dataService.PostClueResponse(ClueId, position.Latitude, position.Longitude, resizedImage, _response?.Version);

                    if (_response != null)
                    {
                        await _navigationService.GoBackAsync();
                    }
                }
            }
            catch (Exception)
            {
                IsBusy = false;
                await RefreshClue();

                await _messageDialogService.ShowAsync("Submit Error", "There was some error. Try Again.");
            }

            IsBusy = false;
        }