Exemple #1
0
        private void PopulateTourTypeFilterComboBox()
        {
            var tourTypesList = new List <string>();

            SortableList <StatsDomainObject> pilotStats = null;

            try
            {
                pilotStats = Registry.GetPilotStats(PilotName).FighterStatsList;
            }
            catch (PilotDoesNotExistInRegistryException)
            {
                //ignore.
            }

            if (pilotStats == null)
            {
                return;
            }

            foreach (var fs in pilotStats.Where(fs => fs.TourType != "[UNKNOWN]")
                     .Where(fs => !tourTypesList.Contains(fs.TourType)))
            {
                tourTypesList.Add(fs.TourType);
            }

            foreach (var tourType in tourTypesList)
            {
                cmbxTourTypeFilter.Items.Add(tourType);
            }

            cmbxTourTypeFilter.SelectedIndex = 0;
        }
Exemple #2
0
        private SortableList <StatsDomainObject> GetStats(string mode, string filterTourType)
        {
            var list = new SortableList <StatsDomainObject>();

            switch (mode)
            {
            case "Fighter":
                list = Registry.GetPilotStats(PilotName).FighterStatsList;
                break;

            case "Attack":
                list = Registry.GetPilotStats(PilotName).AttackStatsList;
                break;

            case "Bomber":
                list = Registry.GetPilotStats(PilotName).BomberStatsList;
                break;

            case "Vehicle/Boat":
                list = Registry.GetPilotStats(PilotName).VehicleBoatStatsList;
                break;
            }

            var filteredList = new SortableList <StatsDomainObject>();

            filteredList.AddRange(list.Where(statsObj => statsObj.TourType == filterTourType));

            if (filteredList.Count > 0)
            {
                filteredList.SortList("TourNumber", ListSortDirection.Ascending);
            }

            return(filteredList);
        }