Added Ability to Sort Results by SourceSafe date or Development Date

This commit is contained in:
Rich
2016-01-20 20:14:22 +00:00
parent 8a1e5caff2
commit 116e10218d
4 changed files with 53 additions and 12 deletions

View File

@@ -194,6 +194,7 @@ namespace Sync
private void frmSync_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Location = Location;
WindowState = FormWindowState.Normal;
Properties.Settings.Default.Size = Size;
Properties.Settings.Default.DevelopmentFolder = tbDevelopment.Text;
Properties.Settings.Default.SourceSafeFolder = tbSourceSafe.Text;
@@ -683,5 +684,42 @@ namespace Sync
CompareOneFile(fc.FileName, fc.FileName.Replace(tbDevelopment.Text, tbSSMailBox.Text));
}
}
void dgv_ColumnHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
{
Console.WriteLine("{0},{1}",e.ColumnIndex,e.RowIndex);
SortedList<DateTime, FileCompare> sorted = new SortedList<DateTime, FileCompare>();
List<FileCompare> fcnew = new List<FileCompare>();
//ComparerDevModified myComparer = new ComparerDevModified();
switch (e.ColumnIndex)
{
case 1:
dgv.DataSource = _CheckedOut;
break;
case 2:
foreach (FileCompare fc in _CheckedOut)
sorted.Add(GetUniqueDateTime(sorted,fc.DevModified), fc);
foreach (FileCompare fc in sorted.Values)
fcnew.Add(fc);
dgv.DataSource = fcnew;
break;
case 3:
foreach (FileCompare fc in _CheckedOut)
sorted.Add(GetUniqueDateTime(sorted,fc.SSModified), fc);
foreach (FileCompare fc in sorted.Values)
fcnew.Add(fc);
dgv.DataSource = fcnew;
break;
}
SetColumnWidth();
}
private DateTime GetUniqueDateTime(SortedList<DateTime, FileCompare> sorted, DateTime? dt)
{
DateTime dtUnique = dt ?? DateTime.Now;
while (sorted.Keys.Contains(dtUnique))
dtUnique += TimeSpan.FromTicks(1);
return dtUnique;
}
}
}