private void SpinnerRank_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { List <Heli> helisRank; switch (e.Position) { case 0: helisRank = helisAll; heliAdapter = new HeliAdapter(this, helisRank); listView.Adapter = heliAdapter; break; case 1: helisRank = helisAll.Where(x => x.Rank == "V").ToList(); heliAdapter = new HeliAdapter(this, helisRank); listView.Adapter = heliAdapter; break; case 2: helisRank = helisAll.Where(x => x.Rank == "VI").ToList(); heliAdapter = new HeliAdapter(this, helisRank); listView.Adapter = heliAdapter; break; case 3: helisRank = helisAll.Where(x => x.Rank == "VII").ToList(); heliAdapter = new HeliAdapter(this, helisRank); listView.Adapter = heliAdapter; break; } }
/// <summary> /// Search Dialog Initialization /// </summary> private void SearchDialogInitialization() { dialog = new Dialog(this); inflater = LayoutInflater.From(this); view = inflater.Inflate(Resource.Layout._searchDialog, null); spinnerNation = view.FindViewById <Spinner>(Resource.Id.spinnerNation); spinnerRank = view.FindViewById <Spinner>(Resource.Id.spinnerRank); listView = view.FindViewById <ListView>(Resource.Id.listView); searchView = view.FindViewById <SearchView>(Resource.Id.searchView); searchView.SetQueryHint("AH-64.."); heliAdapter = new HeliAdapter(this, arrayOfHelis.HelisListApi); listView.Adapter = heliAdapter; SpinnerInitialization(); }
private void _InfoSpinnerRank_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { selectedRank = ranks[e.Position].Id; if (selectedNation == 100 && selectedRank == 100) { helis = HeliCollection.GetHeli(); AdapterHeli = new HeliAdapter(this, helis); _InfoSpinnerHeli.Adapter = AdapterHeli; } else if (selectedNation == 100) { List <Heli> helisAll = HeliCollection.GetHeli(); var helivar = from h in helisAll where h.RankId == selectedRank select h; helis = helivar.ToList <Heli>(); AdapterHeli = new HeliAdapter(this, helis); _InfoSpinnerHeli.Adapter = AdapterHeli; } else if (selectedRank == 100) { List <Heli> helisAll = HeliCollection.GetHeli(); var helivar = from h in helisAll where h.NationId == selectedNation select h; helis = helivar.ToList <Heli>(); AdapterHeli = new HeliAdapter(this, helis); _InfoSpinnerHeli.Adapter = AdapterHeli; } else { helis = HeliSelector(selectedNation, selectedRank); AdapterHeli = new HeliAdapter(this, helis); _InfoSpinnerHeli.Adapter = AdapterHeli; } }
private void SpinnerNation_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { helisAll = arrayOfHelis.HelisListApi; spinnerRank.SetSelection(0); switch (e.Position) { case 0: heliAdapter = new HeliAdapter(this, arrayOfHelis.HelisListApi); listView.Adapter = heliAdapter; break; case 1: helisAll = helisAll.Where(x => x.Nation == "USA").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; case 2: helisAll = helisAll.Where(x => x.Nation == "Germany").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; case 3: helisAll = helisAll.Where(x => x.Nation == "USSR").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; case 4: helisAll = helisAll.Where(x => x.Nation == "Britain").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; case 5: helisAll = helisAll.Where(x => x.Nation == "Japan").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; case 6: helisAll = helisAll.Where(x => x.Nation == "China").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; case 7: helisAll = helisAll.Where(x => x.Nation == "Italy").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; case 8: helisAll = helisAll.Where(x => x.Nation == "France").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; case 9: helisAll = helisAll.Where(x => x.Nation == "Sweden").ToList(); heliAdapter = new HeliAdapter(this, helisAll); listView.Adapter = heliAdapter; break; } }