Skip to content

Commit

Permalink
Only create Enum menu item if we're actually going to use it.
Browse files Browse the repository at this point in the history
  • Loading branch information
yaakov-h committed Oct 20, 2019
1 parent d959b04 commit 628e848
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -367,8 +367,6 @@ void OnContextMenuPopup(object sender, EventArgs e)
{
// only allow displaying as an enum value if we're not a steamid

var enumMenuItem = new MenuItem("Display as &Enum Value");

var enumTypesByNamespace = typeof(CMClient).Assembly.ExportedTypes
.Where(x => x.IsEnum)
.GroupBy(x => x.Namespace)
Expand All @@ -377,6 +375,8 @@ void OnContextMenuPopup(object sender, EventArgs e)

if (enumTypesByNamespace.Length > 0)
{
var enumMenuItem = new MenuItem( "Display as &Enum Value" );

foreach (var enumTypes in enumTypesByNamespace)
{
var enumNamespaceMenuItem = new MenuItem(enumTypes.Key);
Expand Down

0 comments on commit 628e848

Please sign in to comment.