Is there some way to include related 'partial' class files?

SyntaxEditor .NET Languages Add-on for WPF Forum

Posted 12 years ago by Nate Smith - Software Engineer, Logical Progression Group
Version: 12.1.0561

I am implementing design tool that generates C# code for a partial class and allows users to write code-behind for certain initialization events.  So I have 2 files involved - one generated and one user-editable.  What I would like to be able to do is have the user-editable file be aware of the generated file (both implementing the same partial class) so that if I add an item to my model, it becomes visible in the code-behind file.  For example, a form designer that allows you to drag a Button onto a form and name it MyButton.  Each time I add or remove an item on the form, I would generate a file called PageOne.g.cs that has a Button called MyButton in a partial class called PageOne.  The code-behind file called PageOne.cs has an event handler called PageOne_Loaded and I would like to have IntelliPrompt be aware of the MyButton variable that is declared in the PageOne.g.cs file.  So, simply put, is there a way to make the editor "aware" of other files besides just its Document property?

Comments (2)

Answer - Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA

Sure, if you add it to your project assembly's SourceFiles then it will be available and should fully handle merging partial types for the reflection data.  You can add files like this:

project.SourceFiles.QueueFile(language, file);

 There's a QueueCode method too if you just have the code in a string.

Actipro Software Support

Posted 12 years ago by Nate Smith - Software Engineer, Logical Progression Group

Aha - thanks!  That worked like a charm!

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.