Allows the list to be sorted by ascending order or descending order
This commit is contained in:
parent
ea9e0831c8
commit
4d8cddff8b
@ -258,6 +258,7 @@ namespace Sync
|
|||||||
// Walk though Source Safe and check to see if the files in the Development folder are read-only
|
// Walk though Source Safe and check to see if the files in the Development folder are read-only
|
||||||
FindCheckedOut(new DirectoryInfo(tbSourceSafe.Text));
|
FindCheckedOut(new DirectoryInfo(tbSourceSafe.Text));
|
||||||
dgv.DataSource = _CheckedOut;
|
dgv.DataSource = _CheckedOut;
|
||||||
|
WasSorted = false;
|
||||||
SetColumnWidth();
|
SetColumnWidth();
|
||||||
}
|
}
|
||||||
private void syncAllToolStripMenuItem_Click(object sender, EventArgs e)
|
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
|
// Walk though Source Safe and check to see if the files in the Development folder are read-only
|
||||||
FindDifferent(new DirectoryInfo(tbSourceSafe.Text));
|
FindDifferent(new DirectoryInfo(tbSourceSafe.Text));
|
||||||
dgv.DataSource = _CheckedOut;
|
dgv.DataSource = _CheckedOut;
|
||||||
|
WasSorted = false;
|
||||||
SetColumnWidth();
|
SetColumnWidth();
|
||||||
_ExcludeSolutions = true;
|
_ExcludeSolutions = true;
|
||||||
}
|
}
|
||||||
@ -447,6 +449,7 @@ namespace Sync
|
|||||||
FindDifferent(new DirectoryInfo(tbSourceSafe.Text));
|
FindDifferent(new DirectoryInfo(tbSourceSafe.Text));
|
||||||
_OnlyContentDifferent = false;
|
_OnlyContentDifferent = false;
|
||||||
dgv.DataSource = _CheckedOut;
|
dgv.DataSource = _CheckedOut;
|
||||||
|
WasSorted = false;
|
||||||
SetColumnWidth();
|
SetColumnWidth();
|
||||||
}
|
}
|
||||||
private void frmSync_LocationChanged(object sender, EventArgs e)
|
private void frmSync_LocationChanged(object sender, EventArgs e)
|
||||||
@ -684,11 +687,30 @@ namespace Sync
|
|||||||
CompareOneFile(fc.FileName, fc.FileName.Replace(tbDevelopment.Text, tbSSMailBox.Text));
|
CompareOneFile(fc.FileName, fc.FileName.Replace(tbDevelopment.Text, tbSSMailBox.Text));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
class DescComparer<T> : IComparer<T>
|
||||||
|
{
|
||||||
|
public int Compare(T x, T y)
|
||||||
|
{
|
||||||
|
return Comparer<T>.Default.Compare(y, x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class FwdComparer<T> : IComparer<T>
|
||||||
|
{
|
||||||
|
public int Compare(T x, T y)
|
||||||
|
{
|
||||||
|
return Comparer<T>.Default.Compare(x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool WasSorted = false;
|
||||||
void dgv_ColumnHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
|
void dgv_ColumnHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
|
||||||
{
|
{
|
||||||
Console.WriteLine("{0},{1}",e.ColumnIndex,e.RowIndex);
|
IComparer<DateTime> iCmp= null;
|
||||||
SortedList<DateTime, FileCompare> sorted = new SortedList<DateTime, FileCompare>();
|
if(WasSorted)
|
||||||
|
iCmp = new DescComparer<DateTime>();
|
||||||
|
else
|
||||||
|
iCmp = new FwdComparer<DateTime>();
|
||||||
|
WasSorted = !WasSorted;
|
||||||
|
SortedList<DateTime, FileCompare> sorted = new SortedList<DateTime, FileCompare>(iCmp);
|
||||||
List<FileCompare> fcnew = new List<FileCompare>();
|
List<FileCompare> fcnew = new List<FileCompare>();
|
||||||
//ComparerDevModified myComparer = new ComparerDevModified();
|
//ComparerDevModified myComparer = new ComparerDevModified();
|
||||||
switch (e.ColumnIndex)
|
switch (e.ColumnIndex)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user