/// <summary> /// Checks if all fields are empty or not. If username and password is not empty /// logs in the user /// </summary> private void Login() { UsersList = Task.Run(async() => await usersServices.GetUsersAsync()).Result; if (string.IsNullOrEmpty(Username) || string.IsNullOrEmpty(Password)) { Application.Current.MainPage.DisplayAlert("Empty values", "Please enter Username and Password", "OK"); } else { //Executes when login button is clicked if (DataCollections.UserExists(Username, Password, UsersList)) { Application.Current.MainPage.DisplayAlert("Login Success", "", "OK"); Application.Current.MainPage.Navigation.PushAsync(new MainPage()); } else { Application.Current.MainPage.DisplayAlert("Login Fail", "Please enter correct username and password", "OK"); } } }