diff --git a/PROMS/Sync/Sync/frmSync.cs b/PROMS/Sync/Sync/frmSync.cs index 3eaab354..75825c58 100644 --- a/PROMS/Sync/Sync/frmSync.cs +++ b/PROMS/Sync/Sync/frmSync.cs @@ -258,6 +258,7 @@ namespace Sync // Walk though Source Safe and check to see if the files in the Development folder are read-only FindCheckedOut(new DirectoryInfo(tbSourceSafe.Text)); dgv.DataSource = _CheckedOut; + WasSorted = false; SetColumnWidth(); } private void syncAllToolStripMenuItem_Click(object sender, EventArgs e) @@ -350,6 +351,7 @@ namespace Sync // Walk though Source Safe and check to see if the files in the Development folder are read-only FindDifferent(new DirectoryInfo(tbSourceSafe.Text)); dgv.DataSource = _CheckedOut; + WasSorted = false; SetColumnWidth(); _ExcludeSolutions = true; } @@ -447,6 +449,7 @@ namespace Sync FindDifferent(new DirectoryInfo(tbSourceSafe.Text)); _OnlyContentDifferent = false; dgv.DataSource = _CheckedOut; + WasSorted = false; SetColumnWidth(); } private void frmSync_LocationChanged(object sender, EventArgs e) @@ -684,11 +687,30 @@ namespace Sync CompareOneFile(fc.FileName, fc.FileName.Replace(tbDevelopment.Text, tbSSMailBox.Text)); } } - + class DescComparer : IComparer + { + public int Compare(T x, T y) + { + return Comparer.Default.Compare(y, x); + } + } + class FwdComparer : IComparer + { + public int Compare(T x, T y) + { + return Comparer.Default.Compare(x, y); + } + } + bool WasSorted = false; void dgv_ColumnHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e) { - Console.WriteLine("{0},{1}",e.ColumnIndex,e.RowIndex); - SortedList sorted = new SortedList(); + IComparer iCmp= null; + if(WasSorted) + iCmp = new DescComparer(); + else + iCmp = new FwdComparer(); + WasSorted = !WasSorted; + SortedList sorted = new SortedList(iCmp); List fcnew = new List(); //ComparerDevModified myComparer = new ComparerDevModified(); switch (e.ColumnIndex)