Skip to content

Commit

Permalink
Tree nodes should be ordered by key. (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
DTONeill authored Nov 27, 2018
1 parent d7becd8 commit 34b9979
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>EnhancedDictionaryEditor</id>
<version>1.1.1</version>
<version>1.2.1</version>
<authors>Sigmund,Davidton</authors>
<owners>Sigmund,Davidton</owners>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public DictionnaryKeyTreeNodeRepository(TreeController treeController)

public TreeNodeCollection GetById(string id)
{
var result = new TreeNodeCollection();
IEnumerable<IDictionaryItem> keys;

if (id == RootTreeNodeId)
Expand All @@ -34,14 +35,13 @@ public TreeNodeCollection GetById(string id)
keys = LocalizationService.GetDictionaryItemChildren(Guid.Parse(id));
}

var nodes = new TreeNodeCollection();
var nodes = keys
.OrderBy(x => x.ItemKey)
.Select(x => CreateTreeNode(x, id));

foreach (var dictionnaryKey in keys)
{
nodes.Add(CreateTreeNode(dictionnaryKey, id));
}
result.AddRange(nodes);

return nodes;
return result;
}

private TreeNode CreateTreeNode(IDictionaryItem item, string parentId)
Expand Down

0 comments on commit 34b9979

Please sign in to comment.