private async void doRegister() { if (checkRegister()) { Geolocator geolocator = new Geolocator(); geolocator.DesiredAccuracyInMeters = 50; float[] coord = new float[2]; try { Geoposition geoposition = await geolocator.GetGeopositionAsync( maximumAge : TimeSpan.FromMinutes(5), timeout : TimeSpan.FromSeconds(10) ); coord[0] = float.Parse(geoposition.Coordinate.Latitude.ToString("0.00")); coord[1] = float.Parse(geoposition.Coordinate.Longitude.ToString("0.00")); } catch (Exception ex) { if ((uint)ex.HResult == 0x80004004) { System.Diagnostics.Debug.WriteLine("Cant get location"); coord[0] = 50.0f; coord[1] = 50.0f; } else { } } char[] delimiters = { '/', ' ' }; string[] parsedBirthday = BoxBirthday.Value.ToString().Split(delimiters); string birthday = parsedBirthday[2] + ',' + parsedBirthday[1] + ',' + parsedBirthday[0]; await WeBallAPI.register(BoxPassword.Password, BoxEmail.Text, BoxNom_Complet.Text, birthday, imageInput.Source, coord); NavigationService.Navigate(new Uri("/LoginPage.xaml", UriKind.Relative)); } }