private void SpinnerRank_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            List <Tank> tanksRank;

            switch (e.Position)
            {
            case 0:
                tanksRank        = tanksAll;
                tankAdapter      = new TankAdapter(this, tanksRank);
                listView.Adapter = tankAdapter;
                break;

            case 1:
                tanksRank        = tanksAll.Where(x => x.Rank == "I").ToList();
                tankAdapter      = new TankAdapter(this, tanksRank);
                listView.Adapter = tankAdapter;
                break;

            case 2:
                tanksRank        = tanksAll.Where(x => x.Rank == "II").ToList();
                tankAdapter      = new TankAdapter(this, tanksRank);
                listView.Adapter = tankAdapter;
                break;

            case 3:
                tanksRank        = tanksAll.Where(x => x.Rank == "III").ToList();
                tankAdapter      = new TankAdapter(this, tanksRank);
                listView.Adapter = tankAdapter;
                break;

            case 4:
                tanksRank        = tanksAll.Where(x => x.Rank == "IV").ToList();
                tankAdapter      = new TankAdapter(this, tanksRank);
                listView.Adapter = tankAdapter;
                break;

            case 5:
                tanksRank        = tanksAll.Where(x => x.Rank == "V").ToList();
                tankAdapter      = new TankAdapter(this, tanksRank);
                listView.Adapter = tankAdapter;
                break;

            case 6:
                tanksRank        = tanksAll.Where(x => x.Rank == "VI").ToList();
                tankAdapter      = new TankAdapter(this, tanksRank);
                listView.Adapter = tankAdapter;
                break;

            case 7:
                tanksRank        = tanksAll.Where(x => x.Rank == "VII").ToList();
                tankAdapter      = new TankAdapter(this, tanksRank);
                listView.Adapter = tankAdapter;
                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("M1A2..");

            tankAdapter      = new TankAdapter(this, arrayOfTanks.TanksListApi);
            listView.Adapter = tankAdapter;
            SpinnerInitialization();
        }
예제 #3
0
        private void _InfoSpinnerNation_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            selectedNation = nations[e.Position].Id;

            if (selectedNation == 100 && selectedRank == 100)
            {
                tanks       = TankCollection.GetTank();
                AdapterTank = new TankAdapter(this, tanks);
                _InfoSpinnerTank.Adapter = AdapterTank;
            }
            else
            if (selectedNation == 100)
            {
                List <Tank> tanksAll = TankCollection.GetTank();
                var         tankvar  = from p in tanksAll
                                       where p.RankId == selectedRank
                                       select p;
                tanks       = tankvar.ToList <Tank>();
                AdapterTank = new TankAdapter(this, tanks);
                _InfoSpinnerTank.Adapter = AdapterTank;
            }
            else
            if (selectedRank == 100)
            {
                List <Tank> tanksAll = TankCollection.GetTank();
                var         tankvar  = from p in tanksAll
                                       where p.NationId == selectedNation
                                       select p;
                tanks       = tankvar.ToList <Tank>();
                AdapterTank = new TankAdapter(this, tanks);
                _InfoSpinnerTank.Adapter = AdapterTank;
            }
            else
            {
                tanks       = TankSelector(selectedNation, selectedRank);
                AdapterTank = new TankAdapter(this, tanks);
                _InfoSpinnerTank.Adapter = AdapterTank;
            }
        }
        private void SpinnerNation_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e)
        {
            tanksAll = arrayOfTanks.TanksListApi;
            spinnerRank.SetSelection(0);
            switch (e.Position)
            {
            case 0:
                tankAdapter      = new TankAdapter(this, arrayOfTanks.TanksListApi);
                listView.Adapter = tankAdapter;
                break;

            case 1:
                tanksAll         = tanksAll.Where(x => x.Nation == "USA").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;

            case 2:
                tanksAll         = tanksAll.Where(x => x.Nation == "Germany").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;

            case 3:
                tanksAll         = tanksAll.Where(x => x.Nation == "USSR").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;

            case 4:
                tanksAll         = tanksAll.Where(x => x.Nation == "Britain").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;

            case 5:
                tanksAll         = tanksAll.Where(x => x.Nation == "Japan").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;

            case 6:
                tanksAll         = tanksAll.Where(x => x.Nation == "China").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;

            case 7:
                tanksAll         = tanksAll.Where(x => x.Nation == "Italy").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;

            case 8:
                tanksAll         = tanksAll.Where(x => x.Nation == "France").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;

            case 9:
                tanksAll         = tanksAll.Where(x => x.Nation == "Sweden").ToList();
                tankAdapter      = new TankAdapter(this, tanksAll);
                listView.Adapter = tankAdapter;
                break;
            }
        }