Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/02/12 12:50:39 (12 years ago)
Author:
ascheibe
Message:

#1959 removed string comparison

Location:
trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/HeuristicLab.Clients.Hive.JobManager-3.3.csproj

    r8708 r8718  
    9797  <ItemGroup>
    9898    <Compile Include="ExtensionMethods\TreeNodeExtensions.cs" />
    99     <Compile Include="ListViewItemComparer.cs" />
     99    <Compile Include="ListViewItemDateComparer.cs" />
    100100    <Compile Include="Plugin.cs" />
    101101    <Compile Include="Views\HiveJobManagerView.cs">
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/ListViewItemDateComparer.cs

    r8717 r8718  
    2929  /// See: http://msdn.microsoft.com/en-us/library/ms996467.aspx
    3030  /// </summary>
    31   public class ListViewItemComparer : IComparer {
     31  public class ListViewItemDateComparer : IComparer {
    3232    private int col;
    3333    private SortOrder order;
    3434
    35     public ListViewItemComparer() {
     35    public ListViewItemDateComparer() {
    3636      col = 0;
    3737      order = SortOrder.Ascending;
    3838    }
    3939
    40     public ListViewItemComparer(int column, SortOrder order) {
     40    public ListViewItemDateComparer(int column, SortOrder order) {
    4141      col = column;
    4242      this.order = order;
     
    5252
    5353      if (listViewItemX == null || listViewItemY == null) {
    54         throw new ArgumentException(string.Format("The ListViewItemComparer expects ListViewItems but received {0} and {1}.",
     54        throw new ArgumentException(string.Format("The ListViewItemDateComparer expects ListViewItems but received {0} and {1}.",
    5555          x.GetType().ToString(), y.GetType().ToString()));
    5656      }
     
    6262        returnVal = DateTime.Compare(firstDate, secondDate);
    6363      } else {
    64         // if neither compared object has a valid date format, compare as a string
    65         returnVal = String.Compare(listViewItemX.SubItems[col].Text, listViewItemY.SubItems[col].Text);
     64        throw new ArgumentException(string.Format("The ListViewItemDateComparer expects DateTimes. Can't parse {0} and {1}.",
     65           listViewItemX.SubItems[col].Text, listViewItemY.SubItems[col].Text));
    6666      }
    6767
  • trunk/sources/HeuristicLab.Clients.Hive.JobManager/3.3/Views/RefreshableHiveJobListView.cs

    r8708 r8718  
    4444      this.itemsListView.FullRowSelect = true;
    4545
    46       this.itemsListView.ListViewItemSorter = new ListViewItemComparer(0, SortOrder.Ascending);
     46      this.itemsListView.ListViewItemSorter = new ListViewItemDateComparer(0, SortOrder.Ascending);
    4747      this.itemsListView.Sorting = SortOrder.Ascending;
    4848      this.itemsListView.Sort();
Note: See TracChangeset for help on using the changeset viewer.