private async void Login(string username, string password) { var authorization = new LocalBoxAuthorization(PleioUrl); var result = await authorization.Authorize(username, password); if (result) { var business = new BusinessLayer(); if (DataLayer.Instance.GetLocalBoxesSync().Count == 0) { await business.RegisterLocalBox(PleioUrl); } var activity = (HomeActivity)Activity; activity.HideLoginDialog(); activity.menuFragment.UpdateLocalBoxes(); Toast.MakeText(Activity, "Ingelogd.", ToastLength.Short).Show(); } else { Toast.MakeText(Activity, "Gebruikersnaam en wachtwoord combinatie is ongeldig.", ToastLength.Short).Show(); } }
public override void ViewDidLoad() { base.ViewDidLoad(); ActivityIndicator.Hidden = true; // Perform any additional setup after loading the view, typically from a nib. LoginButton.TouchUpInside += async(s, e) => { LoginButton.Hidden = true; ActivityIndicator.Hidden = false; ActivityIndicator.StartAnimating(); var authorization = new LocalBoxAuthorization(PleioUrl); var result = await authorization.Authorize(LoginField.Text, PasswordField.Text); if (result) { var business = new BusinessLayer(); if (DataLayer.Instance.GetLocalBoxesSync().Count == 0) { await business.RegisterLocalBox(PleioUrl); this._home.InitialiseMenuAfterRegistration(); } this.View.RemoveFromSuperview(); // show (second) site-selection screen if (_introduction) { var sites = new AddSitesViewController(_home, true); sites.View.BackgroundColor = UIColor.FromRGB(14, 94, 167); _home.View.Add(sites.View); _home.AddChildViewController(sites); } } else { LoginButton.Hidden = false; ActivityIndicator.Hidden = true; ActivityIndicator.StopAnimating(); var alert = UIAlertController.Create("Fout", "Gebruikersnaam of wachtwoord is onjuist.", UIAlertControllerStyle.Alert); alert.AddAction(UIAlertAction.Create("Ok", UIAlertActionStyle.Cancel, null)); PresentViewController(alert, animated: true, completionHandler: null); } }; }
public override void ViewDidLoad () { base.ViewDidLoad (); ActivityIndicator.Hidden = true; // Perform any additional setup after loading the view, typically from a nib. LoginButton.TouchUpInside += async (s, e) => { LoginButton.Hidden = true; ActivityIndicator.Hidden = false; ActivityIndicator.StartAnimating(); var authorization = new LocalBoxAuthorization(PleioUrl); var result = await authorization.Authorize(LoginField.Text, PasswordField.Text); if (result) { var business = new BusinessLayer(); if (DataLayer.Instance.GetLocalBoxesSync ().Count == 0) { await business.RegisterLocalBox(PleioUrl); this._home.InitialiseMenuAfterRegistration(); } this.View.RemoveFromSuperview(); // show (second) site-selection screen if (_introduction) { var sites = new AddSitesViewController (_home, true); sites.View.BackgroundColor = UIColor.FromRGB(14, 94, 167); _home.View.Add(sites.View); _home.AddChildViewController(sites); } } else { LoginButton.Hidden = false; ActivityIndicator.Hidden = true; ActivityIndicator.StopAnimating(); var alert = UIAlertController.Create("Fout", "Gebruikersnaam of wachtwoord is onjuist.", UIAlertControllerStyle.Alert); alert.AddAction (UIAlertAction.Create ("Ok", UIAlertActionStyle.Cancel, null)); PresentViewController(alert, animated: true, completionHandler: null); } }; }
private async void Login (string username, string password) { var authorization = new LocalBoxAuthorization (PleioUrl); var result = await authorization.Authorize (username, password); if (result) { var business = new BusinessLayer(); if (DataLayer.Instance.GetLocalBoxesSync ().Count == 0) { await business.RegisterLocalBox (PleioUrl); } var activity = (HomeActivity) Activity; activity.HideLoginDialog (); activity.menuFragment.UpdateLocalBoxes (); Toast.MakeText (Activity, "Ingelogd.", ToastLength.Short).Show (); } else { Toast.MakeText (Activity, "Gebruikersnaam en wachtwoord combinatie is ongeldig.", ToastLength.Short).Show (); } }