private List <Ship> ShipSelector(int selectedNation, int selectedRank) { this.selectedNation = selectedNation; this.selectedRank = selectedRank; List <Ship> shipsAll = ShipCollection.GetShip(); var shipvar = from s in shipsAll where s.NationId == selectedNation where s.RankId == selectedRank select s; return(shipvar.ToList <Ship>()); }
private void _InfoSpinnerRank_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { selectedRank = ranks[e.Position].Id; if (selectedNation == 100 && selectedRank == 100) { ships = ShipCollection.GetShip(); AdapterShip = new ShipAdapter(this, ships); _InfoSpinnerShip.Adapter = AdapterShip; } else if (selectedNation == 100) { List <Ship> shipsAll = ShipCollection.GetShip(); var shipvar = from s in shipsAll where s.RankId == selectedRank select s; ships = shipvar.ToList <Ship>(); AdapterShip = new ShipAdapter(this, ships); _InfoSpinnerShip.Adapter = AdapterShip; } else if (selectedRank == 100) { List <Ship> shipsAll = ShipCollection.GetShip(); var shipvar = from s in shipsAll where s.NationId == selectedNation select s; ships = shipvar.ToList <Ship>(); AdapterShip = new ShipAdapter(this, ships); _InfoSpinnerShip.Adapter = AdapterShip; } else { ships = ShipSelector(selectedNation, selectedRank); AdapterShip = new ShipAdapter(this, ships); _InfoSpinnerShip.Adapter = AdapterShip; } }
private void ListShower() { if (selectedNation == 100 && selectedRank == 100) { shipsToListView = ShipCollection.GetShip(); TheBestlistView = new ListViewTheBestShipAdapter(this, shipsToListView); _TheBestListView.Adapter = TheBestlistView; } else if (selectedNation == 100) { List <Ship> shipsAll = ShipCollection.GetShip(); var shipvar = from s in shipsAll where s.RankId == selectedRank select s; shipsToListView = shipvar.ToList <Ship>(); TheBestlistView = new ListViewTheBestShipAdapter(this, shipsToListView); _TheBestListView.Adapter = TheBestlistView; } else if (selectedRank == 100) { List <Ship> shipsAll = ShipCollection.GetShip(); var shipvar = from s in shipsAll where s.NationId == selectedNation select s; shipsToListView = shipvar.ToList <Ship>(); TheBestlistView = new ListViewTheBestShipAdapter(this, shipsToListView); _TheBestListView.Adapter = TheBestlistView; } else { shipsToListView = ShipSelector(selectedNation, selectedRank); TheBestlistView = new ListViewTheBestShipAdapter(this, shipsToListView); _TheBestListView.Adapter = TheBestlistView; } }
private void TaskSelector() { if (SelectedPotentialTaskShip == 1) { List <Ship> shipsAll = ShipCollection.GetShip(); double step = 1.0; var shipvar = from s in shipsAll where s.BR <= selectedShipBR + step && s.BR >= selectedShipBR - step && s.NationId != selectedNation orderby s.MainCaliberSize descending select s; shipspotential = shipvar.ToList <Ship>(); AdapterListView = new ListViewInfoShipAdapter(this, shipspotential); _InfoListView.Adapter = AdapterListView; } if (SelectedPotentialTaskShip == 2) { List <Ship> shipsAll = ShipCollection.GetShip(); double step = 1.0; var shipvar = from s in shipsAll where s.BR <= selectedShipBR + step && s.BR >= selectedShipBR - step && s.NationId != selectedNation orderby s.MainCaliberItem descending select s; shipspotential = shipvar.ToList <Ship>(); AdapterListView = new ListViewInfoShipAdapter(this, shipspotential); _InfoListView.Adapter = AdapterListView; } if (SelectedPotentialTaskShip == 3) { List <Ship> shipsAll = ShipCollection.GetShip(); double step = 1.0; var shipvar = from s in shipsAll where s.BR <= selectedShipBR + step && s.BR >= selectedShipBR - step && s.NationId != selectedNation orderby s.MainCaliberTNT descending select s; shipspotential = shipvar.ToList <Ship>(); AdapterListView = new ListViewInfoShipAdapter(this, shipspotential); _InfoListView.Adapter = AdapterListView; } if (SelectedPotentialTaskShip == 4) { List <Ship> shipsAll = ShipCollection.GetShip(); double step = 1.0; var shipvar = from s in shipsAll where s.BR <= selectedShipBR + step && s.BR >= selectedShipBR - step && s.NationId != selectedNation orderby s.MaxSpeed descending select s; shipspotential = shipvar.ToList <Ship>(); AdapterListView = new ListViewInfoShipAdapter(this, shipspotential); _InfoListView.Adapter = AdapterListView; } if (SelectedPotentialTaskShip == 5) { List <Ship> shipsAll = ShipCollection.GetShip(); double step = 1.0; var shipvar = from s in shipsAll where s.BR <= selectedShipBR + step && s.BR >= selectedShipBR - step && s.NationId != selectedNation orderby s.TorpedoItem descending select s; shipspotential = shipvar.ToList <Ship>(); AdapterListView = new ListViewInfoShipAdapter(this, shipspotential); _InfoListView.Adapter = AdapterListView; } if (SelectedPotentialTaskShip == 6) { List <Ship> shipsAll = ShipCollection.GetShip(); double step = 1.0; var shipvar = from s in shipsAll where s.BR <= selectedShipBR + step && s.BR >= selectedShipBR - step && s.NationId != selectedNation orderby s.TorpedoTNT descending select s; shipspotential = shipvar.ToList <Ship>(); AdapterListView = new ListViewInfoShipAdapter(this, shipspotential); _InfoListView.Adapter = AdapterListView; } if (SelectedPotentialTaskShip == 7) { List <Ship> shipsAll = ShipCollection.GetShip(); double step = 1.0; var shipvar = from s in shipsAll where s.BR <= selectedShipBR + step && s.BR >= selectedShipBR - step && s.NationId != selectedNation orderby s.Displacement descending select s; shipspotential = shipvar.ToList <Ship>(); AdapterListView = new ListViewInfoShipAdapter(this, shipspotential); _InfoListView.Adapter = AdapterListView; } }