I am not much of a programmer and I definitely am not skilled at user interface stuff. Currently I am helping build an iPhone app until we get someone more equipped to build it, but for right now I am having an issue with getting access to a UITextfield.
It is a login page with a username and password. I have three separate storyboard files (this was at the request of another programmer that I am working with). I created three separate classes. I have the LoginPage storyboard and the LoginClass. I have named the UITextfields: Username & Password.
There is an api and a method, both of which require the Username & Password (strings for both the api and method). Here is what I have:
public partial class LoginClass : ViewController
{
private static APICore api = new APICore();
public LoginClass (IntPtr handle) : base (handle)
{
}
public void LoginButtonClicked(UIButton sender)
{
LaunchLoginAPIAsync(sender);
}
private async void LaunchLoginAPIAsync(UIButton sender)
{
string name = Username.Text;
string pass = Password.Text;
UserLogin user = await api.Login(name, pass);
if (user.isInvalidUsername())
{
//Create Alert
var okAlertController = UIAlertController.Create("Error", " Invalid Username. Please try again with a correct username or register using the link below", UIAlertControllerStyle.Alert);
//Add Action
okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
// Present Alert
// PresentViewController(okAlertController, true, null);
}
else if (user.isWrongPassword())
{
//Create Alert
var okAlertController = UIAlertController.Create("Error", "Invalid Password", UIAlertControllerStyle.Alert);
//Add Action
okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
// Present Alert
// PresentViewController(okAlertController, true, null);
}
else if (user.isLoginSuccessful())
{
// Create Alert
var okAlertController = UIAlertController.Create("Logged in!", "Success", UIAlertControllerStyle.Alert);
//Add Action
okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
// PresentViewController(okAlertController, true, null);
}
}
}
The error I am getting is:
"ViewController.Username is not accessible due to its protection level" (and the same with Password).