private async void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (BoxName.Text != "")
            {
                WeBallAPI.currentUser.fullName = BoxName.Text;
            }
            if (BoxEmail.Text != "")
            {
                WeBallAPI.currentUser.email = BoxEmail.Text;
            }
            char[]   delimiters     = { '/', ' ' };
            string[] parsedBirthday = BoxBirthday.Value.ToString().Split(delimiters);
            string   birthday       = parsedBirthday[2] + ',' + parsedBirthday[1] + ',' + parsedBirthday[0];

            WeBallAPI.currentUser.birthday = birthday;
            await WeBallAPI.updateUser();

            if (WeBallAPI.Success == false)
            {
                return;
            }
            MessageBoxResult result =
                MessageBox.Show("Profil édité!",
                                "Confirmation",
                                MessageBoxButton.OK);

            (Application.Current.RootVisual as PhoneApplicationFrame).Navigate(new Uri("/ProfilePage.xaml", UriKind.Relative));
        }
        public static async Task updatePos()
        {
            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;
                    throw new Exception();
                }
                else
                {
                    if (IsolatedStorageSettings.ApplicationSettings.Contains("LastLocation"))
                    {
                        coord = (float[])IsolatedStorageSettings.ApplicationSettings["LastLocation"];
                    }
                    else
                    {
                        throw new Exception();
                    }
                }
            }
            WeBallAPI.currentUser.gps = coord;
            IsolatedStorageSettings.ApplicationSettings["LastLocation"] = coord;
            await WeBallAPI.updateUser();
        }
        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            if (OldPasswordBox.Password.Length == 0)
            {
                setPopup("Merci de saisir votre ancien mot de passe.");
                return;
            }
            if (OldPasswordBox.Password != WeBallAPI.currentUser.password)
            {
                setPopup("Ancien mot de passe incorrect.");
                return;
            }
            if (NewPasswordBox.Password.Length <= 2)
            {
                setPopup("Nouveau mot de passe trop court.");
                return;
            }
            if (NewPasswordBox.Password != VerifyPassword.Password)
            {
                setPopup("Mot de passe différent de la validation.");
                return;
            }
            WeBallAPI.currentUser.password = NewPasswordBox.Password;
            await WeBallAPI.updateUser();

            if (WeBallAPI.Success == false)
            {
                return;
            }
            MessageBoxResult result =
                MessageBox.Show("Mot de passe changé!",
                                "Confirmation",
                                MessageBoxButton.OK);

            NavigationService.Navigate(new Uri("/ProfilePage.xaml", UriKind.Relative));
        }