コード例 #1
0
        private async void buttonLogin_Click(object sender, RoutedEventArgs e)
        {
            await tryLogin(sender, e);

            if (WeBallAPI.Success == false)
            {
                return;
            }
            await WeBallAPI.me();

            if (WeBallAPI.Success == false)
            {
                return;
            }
            System.Diagnostics.Debug.WriteLine("Logging in");
            if (!string.IsNullOrEmpty(WeBallAPI.Token))
            {
                try {
                    await WeBallAPI.updatePos();
                }
                catch (Exception exception)
                {
                    MessageBoxResult result =
                        MessageBox.Show("Problème de localisation, vérifiez vos paramètres.",
                                        "Location",
                                        MessageBoxButton.OK);
                    return;
                }
                System.Diagnostics.Debug.WriteLine("get Fives");
                await WeBallAPI.getFives();

                if (WeBallAPI.Success == false)
                {
                    return;
                }
                NavigationService.Navigate(new Uri("/ProfilePage.xaml", UriKind.Relative));
            }
            else
            {
                System.Diagnostics.Debug.WriteLine("Problem");
            }
        }