Skip to content

Commit

Permalink
different sort modes
Browse files Browse the repository at this point in the history
  • Loading branch information
maltsevda committed Aug 3, 2018
1 parent eccc168 commit 1baa64c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 9 deletions.
11 changes: 4 additions & 7 deletions MainFrame.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions MainFrame.cs
Expand Up @@ -26,6 +26,8 @@ public MainFrame()
findDlg = new FindDialog();

Application.Idle += new EventHandler(OnIdle);


}

//
Expand Down Expand Up @@ -318,6 +320,28 @@ private void UpdateLocaleListTranslation()
dataGrid.ResumeLayout();
}

private void OnSortCompare(object sender, DataGridViewSortCompareEventArgs e)
{
if (e.Column.Index == 0)
{
int cell1AsInt = 0, cell2AsInt = 0;
int.TryParse(e.CellValue1.ToString(), out cell1AsInt);
int.TryParse(e.CellValue2.ToString(), out cell2AsInt);
e.SortResult = cell1AsInt - cell2AsInt;
e.Handled = true;
}
else if (e.Column.Index == 2)
{
var grid = sender as DataGridView;
string namespace1 = grid.Rows[e.RowIndex1].Cells[1].Value.ToString();
string namespace2 = grid.Rows[e.RowIndex2].Cells[1].Value.ToString();
e.SortResult = string.Compare(namespace1, namespace2);
if (e.SortResult == 0)
e.SortResult = string.Compare(e.CellValue1.ToString(), e.CellValue2.ToString());
e.Handled = true;
}
}

//
// Find methods
//
Expand Down
4 changes: 2 additions & 2 deletions Properties/AssemblyInfo.cs
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.1.0.0")]
[assembly: AssemblyFileVersion("1.1.0.0")]

0 comments on commit 1baa64c

Please sign in to comment.