protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); _viewModel = (OrariCompletoViewModel)BindingContext; lista = _viewModel.ListOrari; setUpListView(); }
public SuggerisciCorsiView() { Padding = new Thickness(0, 0, 0, 0); BackgroundColor = ColorHelper.Blue700; Title = "Corsi suggeriti"; _listSource = new List <CorsoCompleto>(); _viewModel = new OrariCompletoViewModel(); getPages(); }
private async void btn_Clicked(object sender, EventArgs e) { Facolta fac = listFacolta.Where(x => x.Nome == pickerFacoltà.Items[pickerFacoltà.SelectedIndex]).First(); int facolta = fac.IdFacolta; string db = fac.DB; int laureaId = dictionaryLauree.Where(x => x.Key == pickerLaurea.Items[pickerLaurea.SelectedIndex]).First().Value; string laurea = dictionaryLauree.Where(x => x.Key == pickerLaurea.Items[pickerLaurea.SelectedIndex]).First().Key; int anno = pickerAnno.SelectedIndex; string annoString = anni[anno]; string semestre = sem.Where(x => x.Key == pickerSemestre.Items[pickerSemestre.SelectedIndex]).First().Value; string semestreString = sem.Where(x => x.Key == pickerSemestre.Items[pickerSemestre.SelectedIndex]).First().Key; bool group = pickerRaggruppa.SelectedIndex == 0 ? false : true; activityIndicator.IsVisible = true; //Settings.FacoltaIndex = pickerFacoltà.SelectedIndex; //Settings.LaureaIndex = pickerLaurea.SelectedIndex; //Settings.AnnoIndex = anno; Settings.Raggruppa = pickerRaggruppa.SelectedIndex; if (!CrossConnectivity.Current.IsConnected) //non connesso a internet { activityIndicator.IsVisible = false; lblError.IsVisible = true; var toast = DependencyService.Get <IToastNotificator>(); await toast.Notify(ToastNotificationType.Error, "Errore", "Nessun accesso a internet", TimeSpan.FromSeconds(3)); return; } string s = await Web.GetOrarioCompleto(semestre, db, facolta, laureaId, anno); if (s == string.Empty) { activityIndicator.IsVisible = false; lblError.IsVisible = true; return; } List <CorsoCompleto> lista = Web.GetSingleOrarioCompleto(s); activityIndicator.IsVisible = false; if (lista.Count > 0) { var completoViewModel = new OrariCompletoViewModel() { Facolta = fac, LaureaString = laurea, Anno = annoString, Semestre = semestreString, ListOrari = lista, Group = group }; var nav = new OrarioCompleto(); nav.BindingContext = completoViewModel; await this.Navigation.PushAsync(nav); // await this.Navigation.PushAsync(new OrarioCompletoGroup(lista, fac.Nome, laurea, annoString, semestreString, group)); } else { lblError.IsVisible = true; return; } }
private async void btnSettings_Clicked(object sender, EventArgs e) { lblError.IsVisible = false; _fac = listFacolta.Where(x => x.Nome == _pickerFacoltà.Items[_pickerFacoltà.SelectedIndex]).First(); int facolta = _fac.IdFacolta; string db = _fac.DB; int laureaId = dictionaryLauree.Where(x => x.Key == _pickerLaurea.Items[_pickerLaurea.SelectedIndex]).First().Value; _laurea = dictionaryLauree.Where(x => x.Key == _pickerLaurea.Items[_pickerLaurea.SelectedIndex]).First().Key; int anno = _pickerAnno.SelectedIndex; _annoString = anni[anno]; string semestre = sem.Where(x => x.Key == _pickerSemestre.Items[_pickerSemestre.SelectedIndex]).First().Value; _semestreString = sem.Where(x => x.Key == _pickerSemestre.Items[_pickerSemestre.SelectedIndex]).First().Key; NUM_CORSI = _pickerNumCorsi.SelectedIndex + 1; int peso = _pickerPesi.SelectedIndex; if (peso == 0) { PESO_GIORNO = 1; PESO_SOVRAPPOSIZIONE = 5; } else { PESO_GIORNO = 10; PESO_SOVRAPPOSIZIONE = 1; } if (!CrossConnectivity.Current.IsConnected) { //non connesso a internet //activityIndicator.IsVisible = false; lblError.IsVisible = true; var toast = DependencyService.Get <IToastNotificator>(); await toast.Notify(ToastNotificationType.Error, "Errore", "Nessun accesso a internet", TimeSpan.FromSeconds(3)); return; } if (_pickerNumCorsi.SelectedIndex == -1 || _pickerPesi.SelectedIndex == -1) { var toast = DependencyService.Get <IToastNotificator>(); await toast.Notify(ToastNotificationType.Warning, "Attenzione", "Devi completare tutti i campi", TimeSpan.FromSeconds(3)); //activityIndicator.IsVisible = false; return; } activityIndicator.IsVisible = true; string s = await Web.GetOrarioCompleto(semestre, db, facolta, laureaId, anno); if (s == string.Empty) { activityIndicator.IsVisible = false; lblError.IsVisible = true; return; } _listSource = Web.GetSingleOrarioCompleto(s); if (_listSource.Count() == 0) { activityIndicator.IsVisible = false; lblError.IsVisible = true; return; } _listaGroup = _listSource.GroupBy(x => x.Semestre); var _listaGroupObb = _listaGroup; _listViewObbligatori.ItemsSource = _listaGroupObb; var _listaGroupSce = _listSource.GroupBy(x => x.Semestre); _listViewScelta.ItemsSource = _listaGroupSce; activityIndicator.IsVisible = false; _viewModel = new OrariCompletoViewModel() { Facolta = _fac, LaureaString = _laurea, Anno = _annoString, Semestre = _semestreString, Group = false }; //_index++; //this.CurrentPage = this.Children[_index]; _index = this.Children.IndexOf(page2_obbligatori); this.CurrentPage = this.Children[_index]; //List<CorsoCompleto> lista = Web.GetSingleOrarioCompleto(s); //activityIndicator.IsVisible = false; }