public SelectCompleto() { Title = "Completo"; Icon = null; listFacolta = Facolta.facolta; pickerFacoltà = new Picker() { Title = "Facoltà" }; pickerLaurea = new Picker() { Title = "Corso di Laurea" }; int index = 0; foreach (var f in listFacolta) { pickerFacoltà.Items.Add(f.Nome); if (f.IdFacolta == Settings.FacoltaId && f.DB == Settings.FacoltaDB) { _facoltàIndex = index; } index++; } //pickerFacoltà.SelectedIndex = facoltàIndex; pickerFacoltà.SelectedIndexChanged += (sender, args) => { var s = pickerFacoltà.Items[pickerFacoltà.SelectedIndex]; Facolta facolta = listFacolta.Where(x => x.Nome == s).First(); //dictionaryLauree = LaureeDictionary.getLauree(facolta).Where(x => x.Value != 0).ToDictionary(x => x.Key, x => x.Value); dictionaryLauree = LaureeDictionary.getLauree(facolta).Where(x => x.Value != 0).ToDictionary(x => x.Key, x => x.Value); pickerLaurea.Items.Clear(); if (dictionaryLauree.Count == 0) { return; } index = 0; foreach (var item in dictionaryLauree) { pickerLaurea.Items.Add(item.Key); if (item.Value == Settings.LaureaId) { _laureaIndex = index; } index++; } pickerLaurea.SelectedIndex = 0; }; anni = new String[] { "TUTTI gli anni", "1° Anno", "2° Anno", "3° Anno", "4° Anno", "5° Anno" }; pickerLaurea.SelectedIndexChanged += (sender, args) => { int i = 0; pickerAnno.IsEnabled = true; if (pickerLaurea.Items.Count > 0) { if (pickerLaurea.Items[pickerLaurea.SelectedIndex].Contains("Magistrale")) { limit = 5; } else if (pickerLaurea.Items[pickerLaurea.SelectedIndex].Contains("LM")) { limit = 2; } else { limit = 3; } pickerAnno.Items.Clear(); foreach (var x in anni) { if (i > limit) { break; } pickerAnno.Items.Add(x); i++; } pickerAnno.SelectedIndex = 0; } }; pickerAnno = new Picker() { Title = "Ordina per..", }; pickerSemestre = new Picker() { Title = "Semestre" }; sem = new Dictionary <string, string>() { { "Primo", "completo" }, { "Secondo", "secondo" } }; pickerRaggruppa = new Picker() { Title = "Raggruppa per.." }; ragg = new String[] { "Corso", "Giorno" }; foreach (var x in anni) { pickerAnno.Items.Add(x); } foreach (var s in sem) { pickerSemestre.Items.Add(s.Key); } foreach (var g in ragg) { pickerRaggruppa.Items.Add(g); } //pickerFacoltà.SelectedIndex = Settings.FacoltaIndex; pickerFacoltà.SelectedIndex = _facoltàIndex; //if (Settings.LaureaIndex == 0) // pickerLaurea.SelectedIndex = 0; //else pickerLaurea.SelectedIndex = _laureaIndex; //pickerLaurea.SelectedIndex = Settings.LaureaIndex; //pickerAnno.SelectedIndex = int.Parse(Settings.Anno) + 1; pickerAnno.SelectedIndex = (int)Settings.AnnoIndex; //Se siamo a Marzo, secondo semsestre pickerSemestre.SelectedIndex = DateTime.Today.Month >= new DateTime(2016, 03, 01).Month&& DateTime.Today.Month <= new DateTime(2016, 06, 01).Month ? 1 : 0; pickerRaggruppa.SelectedIndex = Settings.Raggruppa; lblError = new Label() { Text = "ORARIO NON DISPONIBILE O IN CORSO DI DEFINIZIONE", TextColor = ColorHelper.Red500, FontSize = Device.GetNamedSize(NamedSize.Small, this), HorizontalOptions = LayoutOptions.CenterAndExpand, IsVisible = false, }; activityIndicator = new ActivityIndicator() { IsVisible = false, IsRunning = true, HorizontalOptions = LayoutOptions.Fill }; var btn = new Button() { VerticalOptions = LayoutOptions.EndAndExpand, Text = "Ricerca", BackgroundColor = ColorHelper.Blue700, TextColor = ColorHelper.White, BorderColor = ColorHelper.White, }; btn.Clicked += btn_Clicked; var layout = new StackLayout() { BackgroundColor = ColorHelper.White, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, 10, 10, 10), Orientation = StackOrientation.Vertical, Children = { pickerFacoltà, pickerLaurea, pickerAnno, pickerSemestre, pickerRaggruppa, lblError, activityIndicator, btn } }; Content = layout; }
private View getView() { listFacolta = Facolta.facolta; pickerFacoltà = new Picker() { Title = "Facoltà" }; pickerLaurea = new Picker() { Title = "Corso di Laurea" }; var index = 0; foreach (var f in listFacolta) { pickerFacoltà.Items.Add(f.Nome); if (f.IdFacolta == Settings.FacoltaId && f.DB == Settings.FacoltaDB) { _facoltàIndex = index; } index++; } pickerFacoltà.SelectedIndexChanged += (sender, args) => { var s = pickerFacoltà.Items[pickerFacoltà.SelectedIndex]; Facolta facolta = listFacolta.Where(x => x.Nome == s).First(); dictionaryLauree = LaureeDictionary.getLauree(facolta); pickerLaurea.Items.Clear(); index = 0; foreach (var item in dictionaryLauree) { pickerLaurea.Items.Add(item.Key); if (item.Value == Settings.LaureaId) { _laureaIndex = index; } index++; } pickerLaurea.SelectedIndex = 0; }; pickData = new DatePicker() { Format = "D" }; pickerOrder = new Picker() { Title = "Ordina per..", }; String[] ordina = new String[] { "Alfabetico", "Orario" }; foreach (var x in ordina) { pickerOrder.Items.Add(x); } pickerFacoltà.SelectedIndex = _facoltàIndex; pickerLaurea.SelectedIndex = _laureaIndex; //devo tenere conto di GENERALE pickerOrder.SelectedIndex = Settings.Order; var btn = new Button() { VerticalOptions = LayoutOptions.EndAndExpand, Text = "Ricerca", BackgroundColor = ColorHelper.Blue700, TextColor = ColorHelper.White, BorderColor = ColorHelper.White, }; activityIndicator = new ActivityIndicator() { IsVisible = false, IsRunning = true, HorizontalOptions = LayoutOptions.Fill }; lblError = new Label() { Text = "ORARIO NON DISPONIBILE O IN CORSO DI DEFINIZIONE", TextColor = ColorHelper.Red500, HorizontalOptions = LayoutOptions.CenterAndExpand, FontSize = Device.GetNamedSize(NamedSize.Small, this), IsVisible = false, }; btn.Clicked += btn_Clicked; var layout = new StackLayout() { BackgroundColor = ColorHelper.White, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, 10, 10, 10), Orientation = StackOrientation.Vertical, Children = { pickerFacoltà, pickerLaurea, pickData, pickerOrder, lblError, activityIndicator, btn, } }; return(layout); }
private StackLayout initLayout1_settings() { //TODO Picker numero di corsi e peso difficoltà listFacolta = Facolta.facolta; _pickerFacoltà = new Picker() { Title = "Facoltà" }; _pickerLaurea = new Picker() { Title = "Corso di Laurea" }; int index = 0; foreach (var f in listFacolta) { _pickerFacoltà.Items.Add(f.Nome); if (f.IdFacolta == Settings.FacoltaId && f.DB == Settings.FacoltaDB) { _facoltàIndex = index; } index++; } //pickerFacoltà.SelectedIndex = facoltàIndex; _pickerFacoltà.SelectedIndexChanged += (sender, args) => { var s = _pickerFacoltà.Items[_pickerFacoltà.SelectedIndex]; Facolta facolta = listFacolta.Where(x => x.Nome == s).First(); //dictionaryLauree = LaureeDictionary.getLauree(facolta).Where(x => x.Value != 0).ToDictionary(x => x.Key, x => x.Value); dictionaryLauree = LaureeDictionary.getLauree(facolta).Where(x => x.Value != 0).ToDictionary(x => x.Key, x => x.Value); _pickerLaurea.Items.Clear(); if (dictionaryLauree.Count == 0) { return; } index = 0; foreach (var item in dictionaryLauree) { _pickerLaurea.Items.Add(item.Key); if (item.Value == Settings.LaureaId) { _laureaIndex = index; } index++; } _pickerLaurea.SelectedIndex = 0; }; anni = new String[] { "TUTTI gli anni", "1° Anno", "2° Anno", "3° Anno", "4° Anno", "5° Anno" }; _pickerLaurea.SelectedIndexChanged += (sender, args) => { int i = 0; _pickerAnno.IsEnabled = true; if (_pickerLaurea.Items.Count > 0) { if (_pickerLaurea.Items[_pickerLaurea.SelectedIndex].Contains("Magistrale")) { limit = 5; } else if (_pickerLaurea.Items[_pickerLaurea.SelectedIndex].Contains("LM")) { limit = 2; } else { limit = 3; } _pickerAnno.Items.Clear(); foreach (var x in anni) { if (i > limit) { break; } _pickerAnno.Items.Add(x); i++; } _pickerAnno.SelectedIndex = 0; } }; _pickerAnno = new Picker() { Title = "Ordina per..", }; _pickerSemestre = new Picker() { Title = "Semestre" }; sem = new Dictionary <string, string>() { { "Primo", "completo" }, { "Secondo", "secondo" } }; foreach (var x in anni) { _pickerAnno.Items.Add(x); } foreach (var s in sem) { _pickerSemestre.Items.Add(s.Key); } //pickerFacoltà.SelectedIndex = Settings.FacoltaIndex; _pickerFacoltà.SelectedIndex = _facoltàIndex; //if (Settings.LaureaIndex == 0) // pickerLaurea.SelectedIndex = 0; //else _pickerLaurea.SelectedIndex = _laureaIndex; //pickerLaurea.SelectedIndex = Settings.LaureaIndex; //pickerAnno.SelectedIndex = int.Parse(Settings.Anno) + 1; _pickerAnno.SelectedIndex = (int)Settings.AnnoIndex; //Se siamo a Marzo, secondo semsestre _pickerSemestre.SelectedIndex = DateTime.Today.Month >= new DateTime(2016, 03, 01).Month&& DateTime.Today.Month <= new DateTime(2016, 06, 01).Month ? 1 : 0; _pickerNumCorsi = new Picker() { Title = "Numero corsi" }; for (int i = 1; i < 11; i++) { _pickerNumCorsi.Items.Add(i.ToString()); } _pickerPesi = new Picker() { Title = "Ti pesa andare un giorno in più?" }; _pickerPesi.Items.Add("Non è un problema!"); _pickerPesi.Items.Add("Molto! Preferirei evitare"); lblError = new Label() { Text = "ORARIO NON DISPONIBILE O IN CORSO DI DEFINIZIONE", TextColor = ColorHelper.Red500, FontSize = Device.GetNamedSize(NamedSize.Small, this), HorizontalOptions = LayoutOptions.CenterAndExpand, IsVisible = false, }; activityIndicator = new ActivityIndicator() { IsVisible = false, IsRunning = true, HorizontalOptions = LayoutOptions.Fill }; var btn = new Button() { VerticalOptions = LayoutOptions.EndAndExpand, Text = "Avanti", BackgroundColor = ColorHelper.Blue700, TextColor = ColorHelper.White, BorderColor = ColorHelper.White, }; btn.Clicked += btnSettings_Clicked; var layout = new StackLayout() { BackgroundColor = ColorHelper.White, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(15, 10, 15, 10), Orientation = StackOrientation.Vertical, Children = { _pickerFacoltà, _pickerLaurea, _pickerAnno, _pickerSemestre, _pickerNumCorsi, _pickerPesi, lblError, activityIndicator, btn } }; return(layout); }
private View getView() { var lblWelcome = new Label() { Text = string.Format("Welcome {0}", Settings.Name), HorizontalOptions = LayoutOptions.CenterAndExpand }; listFacolta = Facolta.facolta; _imgAvatar = new CircleImage { BorderColor = Color.White, BorderThickness = 1, HeightRequest = 150, WidthRequest = 150, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.CenterAndExpand, VerticalOptions = LayoutOptions.StartAndExpand, }; if (Settings.Picture != string.Empty) { _imgAvatar.Source = Settings.Picture; } //else //immagine predefinita o possibilità di caricare una propria foto???? _entryNome = new Entry() { Placeholder = "Nome", //Text = "Lorenzo", HorizontalOptions = LayoutOptions.FillAndExpand, Keyboard = Keyboard.Text, Text = Settings.GivenName }; _entryCognome = new Entry() { HorizontalOptions = LayoutOptions.FillAndExpand, //Text = "Giudici", Placeholder = "Cognome", Keyboard = Keyboard.Text, Text = Settings.Surname }; _entryCognome.TextChanged += _entryCognome_TextChanged; _entryMail = new Entry() { HorizontalOptions = LayoutOptions.FillAndExpand, Text = Settings.Username, //Placeholder = "n.cognome2" }; _entryMatricola = new Entry() { Placeholder = "Matr.", //Text = "1020589", HorizontalOptions = LayoutOptions.FillAndExpand, }; _pickFacolta = new Picker() { HorizontalOptions = LayoutOptions.FillAndExpand, Title = "Facoltà" }; _pickLaurea = new Picker() { HorizontalOptions = LayoutOptions.FillAndExpand, Title = "Laurea", IsEnabled = false, }; _pickAnno = new Picker() { HorizontalOptions = LayoutOptions.FillAndExpand, Title = "Anno", IsEnabled = false }; foreach (var f in listFacolta) { _pickFacolta.Items.Add(f.Nome); } _pickFacolta.SelectedIndexChanged += (sender, args) => { var s = _pickFacolta.Items[_pickFacolta.SelectedIndex]; Facolta facolta = listFacolta.Where(x => x.Nome == s).First(); dictionaryLauree = LaureeDictionary.getLauree(facolta).Where(x => x.Value != 0).ToDictionary(x => x.Key, x => x.Value); _pickLaurea.Items.Clear(); foreach (var item in dictionaryLauree) { _pickLaurea.Items.Add(item.Key); } _pickLaurea.SelectedIndex = 0; _pickLaurea.IsEnabled = true; }; String[] anni = new String[] { "1° Anno", "2° Anno", "3° Anno", "4° Anno", "5° Anno" }; _pickLaurea.SelectedIndexChanged += (sender, args) => { int i = 1; _pickAnno.IsEnabled = true; if (_pickLaurea.Items.Count > 0) { if (_pickLaurea.Items[_pickLaurea.SelectedIndex].Contains("Magistrale")) { limit = 5; } else if (_pickLaurea.Items[_pickLaurea.SelectedIndex].Contains("LM")) { limit = 2; } else { limit = 3; } _pickAnno.Items.Clear(); foreach (var x in anni) { if (i > limit) { break; } _pickAnno.Items.Add(x); i++; } _pickAnno.SelectedIndex = 0; } }; _lblNotific = new Label() { HorizontalOptions = LayoutOptions.StartAndExpand, Text = "Notifiche variazioni lezioni" }; _switchSync = new Switch() { IsToggled = true }; _lblSync = new Label() { HorizontalOptions = LayoutOptions.StartAndExpand, Text = "Aggiornamento in bakgruound" }; _switchNotific = new Switch() { IsToggled = true }; _activityIndicator = new ActivityIndicator() { HorizontalOptions = LayoutOptions.CenterAndExpand, IsRunning = true, IsVisible = false, }; var grid = new Grid() { Padding = new Thickness(15, 5, 15, 5), HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, RowSpacing = 8, ColumnSpacing = 8, RowDefinitions = { new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, new RowDefinition { Height = GridLength.Auto }, }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(0.6, GridUnitType.Star) }, } }; //DA AGGIUNGERE ROW CON LABEL WELCOM NOME grid.Children.Add(_imgAvatar, 0, 2, 0, 1); grid.Children.Add(_entryNome, 0, 2, 1, 2); grid.Children.Add(_entryCognome, 0, 2, 2, 3); grid.Children.Add(_entryMail, 0, 1, 3, 4); grid.Children.Add(_entryMatricola, 1, 2, 3, 4); grid.Children.Add(_pickFacolta, 0, 2, 4, 5); grid.Children.Add(_pickLaurea, 0, 1, 5, 6); grid.Children.Add(_pickAnno, 1, 2, 5, 6); grid.Children.Add(_lblSync, 0, 1, 6, 7); grid.Children.Add(_switchSync, 1, 2, 6, 7); grid.Children.Add(_lblNotific, 0, 1, 7, 8); grid.Children.Add(_switchNotific, 1, 2, 7, 8); grid.Children.Add(_activityIndicator, 0, 2, 8, 9); // tbiNext = new ToolbarItem("Avanti", "ic_next.png", toolbarItem_next, 0, 0); // //if (Device.OS == TargetPlatform.Android) // //{ // BUG: Android doesn't support the icon being null // // tbiNext = new ToolbarItem("Avanti", "ic_menu.png", () => // // { // // Navigation.PushAsync(new MasterDetailView()); // // }, 0, 0); // //} // //if (Device.OS == TargetPlatform.WinPhone) // //{ // // tbi = new ToolbarItem("Avanti", "ic_menu.png", () => // // { // // Navigation.PushAsync(new MasterDetailView()); // // }, 0, 0); // //} // ToolbarItems.Add(tbiNext); return(grid); }