Exemplo n.º 1
0
        /// <summary>
        /// Sort a list of search results by the given key
        /// </summary>
        /// <param name="results"></param>
        private static void Sort(List <PackageManagerSearchElement> results, PackageSortingKey key)
        {
            switch (key)
            {
            case PackageSortingKey.NAME:
                results.Sort((e1, e2) => e1.Name.ToLower().CompareTo(e2.Name.ToLower()));
                break;

            case PackageSortingKey.DOWNLOADS:
                results.Sort((e1, e2) => e2.Downloads.CompareTo(e1.Downloads));
                break;

            case PackageSortingKey.LAST_UPDATE:
                results.Sort((e1, e2) => e2.Versions.Last().Item1.created.CompareTo(e1.Versions.Last().Item1.created));
                break;

            case PackageSortingKey.VOTES:
                results.Sort((e1, e2) => e2.Votes.CompareTo(e1.Votes));
                break;

            case PackageSortingKey.MAINTAINERS:
                results.Sort((e1, e2) => e1.Maintainers.ToLower().CompareTo(e2.Maintainers.ToLower()));
                break;
            }
        }
 /// <summary>
 /// Sort a list of search results by the given key
 /// </summary>
 /// <param name="results"></param>
 private static void Sort(List<PackageManagerSearchElement> results, PackageSortingKey key)
 {
     switch (key)
     {
         case PackageSortingKey.NAME:
             results.Sort((e1, e2) => e1.Name.ToLower().CompareTo(e2.Name.ToLower()));
             break;
         case PackageSortingKey.DOWNLOADS:
             results.Sort((e1, e2) => e2.Downloads.CompareTo(e1.Downloads));
             break;
         case PackageSortingKey.LAST_UPDATE:
             results.Sort((e1, e2) => e2.Versions.Last().Item1.created.CompareTo(e1.Versions.Last().Item1.created));
             break;
         case PackageSortingKey.VOTES:
             results.Sort((e1, e2) => e2.Votes.CompareTo(e1.Votes));
             break;
         case PackageSortingKey.MAINTAINERS:
             results.Sort((e1, e2) => e1.Maintainers.ToLower().CompareTo(e2.Maintainers.ToLower()));
             break;
     }
 }
        /// <summary>
        /// Sort a list of search results by the given key
        /// </summary>
        /// <param name="results"></param>
        private static void Sort(List <PackageManagerSearchElementViewModel> results, PackageSortingKey key)
        {
            switch (key)
            {
            case PackageSortingKey.Name:
                results.Sort((e1, e2) => e1.Model.Name.ToLower().CompareTo(e2.Model.Name.ToLower()));
                break;

            case PackageSortingKey.Downloads:
                results.Sort((e1, e2) => e2.Model.Downloads.CompareTo(e1.Model.Downloads));
                break;

            case PackageSortingKey.LastUpdate:
                results.Sort((e1, e2) => e2.Versions.Last().Item1.created.CompareTo(e1.Versions.Last().Item1.created));
                break;

            case PackageSortingKey.Votes:
                results.Sort((e1, e2) => e2.Model.Votes.CompareTo(e1.Model.Votes));
                break;

            case PackageSortingKey.Maintainers:
                results.Sort((e1, e2) => e1.Model.Maintainers.ToLower().CompareTo(e2.Model.Maintainers.ToLower()));
                break;
            }
        }
 /// <summary>
 /// Sort a list of search results by the given key
 /// </summary>
 /// <param name="results"></param>
 private static void Sort(List<PackageManagerSearchElementViewModel> results, PackageSortingKey key)
 {
     switch (key)
     {
         case PackageSortingKey.Name:
             results.Sort((e1, e2) => e1.Model.Name.ToLower().CompareTo(e2.Model.Name.ToLower()));
             break;
         case PackageSortingKey.Downloads:
             results.Sort((e1, e2) => e2.Model.Downloads.CompareTo(e1.Model.Downloads));
             break;
         case PackageSortingKey.LastUpdate:
             results.Sort((e1, e2) => e2.Versions.Last().Item1.created.CompareTo(e1.Versions.Last().Item1.created));
             break;
         case PackageSortingKey.Votes:
             results.Sort((e1, e2) => e2.Model.Votes.CompareTo(e1.Model.Votes));
             break;
         case PackageSortingKey.Maintainers:
             results.Sort((e1, e2) => e1.Model.Maintainers.ToLower().CompareTo(e2.Model.Maintainers.ToLower()));
             break;
     }
 }