Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- }
- }
Add Comment
Please, Sign In to add comment