private async void preferiti_list_ItemTapped(object sender, ItemTappedEventArgs e) { if (sender is ListView lv) { lv.SelectedItem = null; } this.IsEnabled = false; RisultatoRicercaInsegnanti r = (RisultatoRicercaInsegnanti)e.Item; Insegnante i = await InsegnantiService.getInsegnante(r.id); if (i.id != 0) { await Navigation.PushAsync(new ProfilePage2(i, "preferiti")); } this.IsEnabled = true; }
private async void Menu_ItemTapped(object sender, ItemTappedEventArgs e) { if (sender is ListView lv) { lv.SelectedItem = null; } ElementoMenu em = (ElementoMenu)e.Item; if (em.testo == "Diventa insegnante") { /*if (Preferences.Get("isInsegnante", false) == true) * await Navigation.PushAsync(new ProfilePage2(new Insegnante())); //sarà da mettere l'insegnante corrente * else * {*/ if (Preferences.Get("id", null) == null) { //await Navigation.PushAsync(new AccountPage()); Navigation.InsertPageBefore(new AccountPage(), this); await Navigation.PopAsync(); } else { Navigation.InsertPageBefore(new EditProfilePage(new Insegnante()), this); await Navigation.PopAsync(); } } else if (em.testo == "Profilo insegnante") { Insegnante i = await InsegnantiService.getInsegnante(int.Parse(Preferences.Get("id", (-1).ToString()))); //occhio al null if (i.id != 0) { //Navigation.InsertPageBefore(new ProfilePage2(i, "menu"), this); //await Navigation.PopAsync(); await Navigation.PushAsync(new ProfilePage2(i, "menu")); } } else if (em.testo == "Insegnanti salvati") { this.IsEnabled = false; //await Navigation.PushAsync(new ProfilePage(new Insegnante())); if (Preferences.Get("id", null) != null) { RisultatoRicercaInsegnanti[] risultati = await InsegnantiService.getPreferiti(int.Parse(Preferences.Get("id", null))); //eventualmente da spostare nella PreferitiPage Navigation.InsertPageBefore(new PreferitiPage(risultati), this); await Navigation.PopAsync(); } else { Navigation.InsertPageBefore(new AccountPage(), this); await Navigation.PopAsync(); } this.IsEnabled = true; } else if (em.testo == "Accedi o crea il tuo Account") { Navigation.InsertPageBefore(new AccountPage(), this); await Navigation.PopAsync(); } else if (em.testo == "Il tuo account") { Navigation.InsertPageBefore(new UserAccountPage(), this); await Navigation.PopAsync(); } //Navigation.InsertPageBefore(page, this); //await Navigation.PopAsync(); }