Esempio n. 1
0
        public RomDesc Sort(SortType sortType)
        {
            if (FilteredList.Count < 1)
            {
                return(null);
            }
            if (actIndex < 0)
            {
                actIndex = 0;
            }
            if (actIndex >= FilteredList.Count)
            {
                actIndex = FilteredList.Count - 1;
            }
            var name = FilteredList[actIndex].Key;

            //UpdateStats();
            _sortType = sortType;
            switch (sortType)
            {
            case SortType.AZ:
                FilteredList.Sort();
                break;

            case SortType.Ranking:
                FilteredList.Sort(new RankingComparer());
                break;

            case SortType.MostRecentlyPlayed:
                FilteredList.Sort(new MostRecentlyPlayedComparer());
                break;

            case SortType.Year:
                FilteredList.Sort(new YearComparer());
                break;

            case SortType.Manufacturer:
                FilteredList.Sort(new ManufacturerComparer());
                break;

            case SortType.Category:
                FilteredList.Sort(new CategoryComparer());
                break;

            case SortType.InputControl:
                FilteredList.Sort(new InputControlComparer());
                break;

            case SortType.ExternalKey:
                FilteredList.Sort(new ExternalKeyComparer());
                break;
            }
            UpdateSelection();
            return(FilteredList.Find(c => c.Key == name));
            //return FilteredList[actIndex];
        }