// <copyright file="GroupedFolderComparer.cs" company="GoalBook"> // Copyright © 2009 Mark Brownsword. All rights reserved. // This source code and supporting files are licensed under The Code Project // Open License (CPOL) as detailed at http://www.codeproject.com/info/cpol10.aspx. // </copyright> namespace GoalBook.Infrastructure.Comparers { using System; using System.Collections; using GoalBook.Infrastructure.ObjectModel; using Infragistics.Windows.DataPresenter; /// <summary> /// Folder Comparer. /// </summary> public class GroupedFolderComparer : IComparer { /// <summary> /// Declaration for FolderComparer. /// </summary> private FolderComparer folderComparer; /// <summary> /// Initializes a new instance of the GroupedFolderComparer class. /// </summary> /// <param name="folders">list of folders</param> public GroupedFolderComparer(FolderList folders) { this.folderComparer = new FolderComparer(folders); } /// <summary> /// Compare implementation. /// </summary> /// <param name="x">x parameter</param> /// <param name="y">y parameter</param> /// <returns> /// Value Condition /// Less than zero x is less than y /// Zero x equals y /// Greater than zero x is greater than y /// </returns> public int Compare(object x, object y) { if (x == y) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } GroupByRecord t1 = x as GroupByRecord; GroupByRecord t2 = y as GroupByRecord; if (t1 == null) { return -1; } else if (t2 == null) { return 1; } // Use FolderComparer to perform the comparison. return this.folderComparer.Compare(t1.Value, t2.Value); } } }
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)