Skip to content

Commit

Permalink
Merge pull request #4093 from mansellan/4046
Browse files Browse the repository at this point in the history
VB6 - Fix project and component events
  • Loading branch information
retailcoder committed Jun 17, 2018
2 parents 27f33e3 + 4b6147c commit 38be737
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion Rubberduck.VBEditor.VB6/SafeComWrappers/VB/VBProject.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -63,7 +64,20 @@ public EnvironmentMode Mode
return 0;
}

return (EnvironmentMode) EbMode();
// Note - the value returned by the EbMode function does NOT match with the EnvironmentMode enum, hence remapped below.
var ebMode = EbMode();
switch (ebMode)
{
case 0:
return EnvironmentMode.Design;
case 1:
return EnvironmentMode.Run;
case 2:
return EnvironmentMode.Break;
default:
Debug.Assert(false, $"Unexpected value '{ebMode}' returned from EbMode");
return EnvironmentMode.Design;
}
}
}

Expand Down

0 comments on commit 38be737

Please sign in to comment.