Skip to content

Commit

Permalink
Setting the output library to MonoGame now adds a needed using statement
Browse files Browse the repository at this point in the history
  • Loading branch information
vchelaru committed Oct 30, 2024
1 parent 1975e46 commit 1158405
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions CodeOutputPlugin/Views/CodeWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private void CreateGridCategories()
private void CreateProjectWideUi()
{
var projectCategory = new MemberCategory("Project-Wide Code Generation");
projectCategory.Members.Add(CreateProjectTypeSelectionMember());
projectCategory.Members.Add(CreateOutputLibrarySelectionMember());
projectCategory.Members.Add(CreateGenerateObjectInstantiationTypeMember());
projectCategory.Members.Add(CreateProjectUsingStatementsMember());
projectCategory.Members.Add(CreateCodeProjectRootMember());
Expand All @@ -106,7 +106,7 @@ private void CreateProjectWideUi()
DataGrid.Categories.Add(projectCategory);
}

private InstanceMember CreateProjectTypeSelectionMember()
private InstanceMember CreateOutputLibrarySelectionMember()
{
var member = new InstanceMember("Output Library", this);

Expand All @@ -115,6 +115,16 @@ private InstanceMember CreateProjectTypeSelectionMember()
if (CodeOutputProjectSettings != null)
{
CodeOutputProjectSettings.OutputLibrary = (OutputLibrary)args.Value;
// Check for required using statements:
if(CodeOutputProjectSettings.OutputLibrary == OutputLibrary.MonoGame)
{
// This should have MonoGameGum.GueDeriving
if(CodeOutputProjectSettings.CommonUsingStatements.Contains("using MonoGameGum.GueDeriving;")== false)
{
CodeOutputProjectSettings.CommonUsingStatements += "\nusing MonoGameGum.GueDeriving;";
}
}
CodeOutputSettingsPropertyChanged?.Invoke(this, null);
}
};
Expand Down

0 comments on commit 1158405

Please sign in to comment.