private async void search_btn_Clicked(object sender, EventArgs e) { this.progressBar.Opacity = 1; this.progressBar.ProgressTo(0.80, 1500, Easing.CubicInOut); filtri.nomeMateria = en_materia.Text; //filtri.posizione = (Posizione) await positionAdapter.calcolaPosizione(); //filtri.posizione = await positionAdapter.Indirizzo2Posizione(Preferences.Get("indirizzoCorrente", null)); Posizione pos = new Posizione(); //if(Preferences.Get("latitudineCorrente", null) == null && Preferences.Get("longitudineCorrente", null) == null) if (Preferences.Get("isUsingCurrentPos", null) == null) { await DisplayAlert("Per eseguire la ricerca è necessaria la tua posizione", "Accendi la posizione del dispositivo o inserisci un indirizzo", "Ok"); } else { filtri.posizione = await positionAdapter.decidiPosizione(); /*pos.latitudine = double.Parse(Preferences.Get("latitudineCorrente", null)); * pos.longitudine = double.Parse(Preferences.Get("longitudineCorrente", null)); * pos.indirizzo = Preferences.Get("indirizzoCorrente", null); * filtri.posizione = pos;*/ RisultatoRicercaInsegnanti[] insegnanti = await InsegnantiService.GetInsegnanti(filtri); if (insegnanti != null) { foreach (RisultatoRicercaInsegnanti r in insegnanti) { r.distanza = this.positionAdapter.approssimaDistanza(r.distanza); /* * if (r.valutazioneMedia == null || r.valutazioneMedia == "") * { * //qualcosa per togliere la valutazione * r.valutazioneMedia = "-"; * }*/ } insegnanti_list.IsVisible = true; ListaDiMaterie.IsVisible = false; insegnanti_list.ItemsSource = insegnanti; this.lb_errore.IsVisible = false; } else { this.ListaDiMaterie.IsVisible = false; this.lb_errore.IsVisible = true; insegnanti_list.IsVisible = false; Console.WriteLine("Nessun insegnante"); } } this.WelcomeLabel.IsVisible = false; await this.progressBar.ProgressTo(1, 200, Easing.CubicInOut); this.progressBar.Opacity = 0; this.progressBar.ProgressTo(0, 0, Easing.Linear); }
private async void bt_applica_Clicked(object sender, EventArgs e) { //PROGRESS BAR this.progressBar.Opacity = 1; this.progressBar.ProgressTo(0.80, 1500, Easing.CubicInOut); filtri.tariffaMassima = float.Parse(en_tariffa.Text); filtri.valutazioneMinima = float.Parse(en_valutazione.Text); filtri.distanzaMassima = float.Parse(en_distanzaMax.Text); //filtri.posizione = (Posizione)await positionAdapter.calcolaPosizione(); /* * if (Preferences.Get("latitudineDefault", null) != null && cb_posizione.IsChecked) * { * Posizione pos = new Posizione(); * pos.latitudine = double.Parse(Preferences.Get("latitudineDefault", null)); * pos.longitudine = double.Parse(Preferences.Get("longitudineDefault", null)); * pos.indirizzo = Preferences.Get("indirizzoDefault", null); * filtri.posizione = pos; * } * else * { * filtri.posizione = await positionAdapter.Indirizzo2Posizione(Preferences.Get("indirizzoCorrente", null)); * }*/ if (Preferences.Get("isUsingCurrentPos", null) == null) { await DisplayAlert("Per eseguire la ricerca è necessaria la tua posizione", "Accendi la posizione del dispositivo o inserisci un indirizzo", "Ok"); } else { filtri.posizione = await positionAdapter.decidiPosizione(); RisultatoRicercaInsegnanti[] elenco = await InsegnantiService.GetInsegnanti(filtri); if (elenco != null) { foreach (RisultatoRicercaInsegnanti r in elenco) { r.distanza = this.positionAdapter.approssimaDistanza(r.distanza); } parent.makeSubjectsInvisible(); insegnanti_list.IsVisible = true; insegnanti_list.ItemsSource = elenco; this.lb_errore.IsVisible = false; } else { insegnanti_list.IsVisible = false; this.lb_errore.IsVisible = true; Console.WriteLine("Nessun insegnante"); } } this.welcomeLabel.IsVisible = false; //PROGRESS BAR await this.progressBar.ProgressTo(1, 200, Easing.CubicInOut); this.progressBar.Opacity = 0; this.progressBar.ProgressTo(0, 0, Easing.Linear); this.listaDiMaterie.IsVisible = false; parent.Opacity = 1; await Rg.Plugins.Popup.Services.PopupNavigation.Instance.PopAsync(true); SearchPage searchPage = (SearchPage)this.parent; }