示例#1
0
 public void Sort(SnookerMatchSortEnum sort)
 {
     this.SortType = sort;
     this.updateSortButton();
     if (this.AllMatches != null)
     {
         base.Fill(SnookerMatchScore.Sort(AllMatches, SortType).ToList());
     }
 }
示例#2
0
        public static List <SnookerMatchScore> Sort(List <SnookerMatchScore> matches, SnookerMatchSortEnum sort)
        {
            if (sort == SnookerMatchSortEnum.ByDate)
            {
                return((from i in matches
                        orderby i.Date descending
                        select i).ToList());
            }

            if (sort == SnookerMatchSortEnum.ByFrameCount)
            {
                return((from i in matches
                        orderby i.MatchScoreA + i.MatchScoreB descending, i.Date descending
                        select i).ToList());
            }

            if (sort == SnookerMatchSortEnum.ByWinFirst)
            {
                return((from i in matches
                        orderby i.MatchScoreA - i.MatchScoreB descending, i.MatchScoreA descending, i.Date descending
                        select i).ToList());
            }

            if (sort == SnookerMatchSortEnum.ByLossFirst)
            {
                return((from i in matches
                        orderby i.MatchScoreA - i.MatchScoreB ascending, i.MatchScoreB descending, i.Date descending
                        select i).ToList());
            }

            if (sort == SnookerMatchSortEnum.ByBestFrame)
            {
                return((from i in matches
                        orderby i.MaxFrameScoreA descending, i.Date descending
                        select i).ToList());
            }

            if (sort == SnookerMatchSortEnum.ByOpponent)
            {
                return((from i in matches
                        orderby i.OpponentName, i.OpponentAthleteID, i.Date descending
                        select i).ToList());
            }

            return(matches);
        }
示例#3
0
 public void Sort(SnookerMatchSortEnum sort)
 {
     this.SortType = sort;
     this.updateSortButton();
     this.Fill(Matches);
 }