コード例 #1
0
        async void navigateToMainPage(object sender, System.EventArgs e)
        {
            List <User> allUsers = await service.GetAllUsers();

            bool userFound = false;

            foreach (User user in allUsers)
            {
                if (username.Text == user.username && password.Text == user.password)
                {
                    Console.WriteLine("Found User");
                    User loggedUser = user;
                    userFound = true;
                    await Navigation.PushAsync(new MainPage(loggedUser.id));

                    break;
                }
            }
            if (!userFound)
            {
                await DisplayAlert("Invalid Credentials", "Please enter valid credentials", "OK");
            }
        }