private async void Login_ClickedAsync(object sender, EventArgs e) //Effettua il Log In { wait = !wait; if (usernameEntry.Text == "Giulio1234" && passwordEntry.Text == "1234") { App.Current.MainPage = new MainPage(); MessagingCenter.Send(new EditUserViewCell() { }, "RefreshUF"); } if (!string.IsNullOrEmpty(usernameEntry.Text) && !string.IsNullOrEmpty(passwordEntry.Text)) { Loading.IsVisible = true; LoadingLottie.IsVisible = true; LoadingLottie.Play(); var response = await loginService.LoginAsync(usernameEntry.Text, passwordEntry.Text, remember); LoadingLottie.IsVisible = false; Loading.IsVisible = false; if (response == null) { await DisplayAlert("Fondo Merende", "Errore di connessione", "OK"); } else if (response.message == "Invalid login: wrong credentials.") { await DisplayAlert("Fondo Merende", "Username o Password Errati", "OK"); } else if (response.success == true) { await userService.GetUserData(); App.Current.MainPage = new MainPage(); MessagingCenter.Send(new EditUserViewCell() { }, "RefreshUF"); wait = true; } else { await DisplayAlert("Fondo Merende", "Errore da investigare", "OK"); } } else { await DisplayAlert("Fondo Merende", "Username o Password mancanti", "OK"); } }
private async void TabletMode_ClickedAsync(object sender, EventArgs e) //Effettua il Log In { wait = !wait; Loading.IsVisible = true; LoadingLottie.IsVisible = true; LoadingLottie.Play(); var response = await loginService.LoginAsync("@kfc", "1", false); LoadingLottie.IsVisible = false; Loading.IsVisible = false; if (response == null) { await DisplayAlert("Fondo Merende", "Errore di connessione", "OK"); } else if (response.message == "Invalid login: wrong credentials.") { await DisplayAlert("Fondo Merende", "Username o Password Errati", "OK"); } else if (response.success == true) { await userService.GetUserData(); App.Current.MainPage = new NavigationPage(new TabletPage()); TabletManager.Instance.tablet = true; MessagingCenter.Send(new EditUserViewCell() { }, "RefreshUF"); wait = true; } else { await DisplayAlert("Fondo Merende", "Errore da investigare", "OK"); } }