SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Searching for designer generated code

Last post 11-26-2007 9:28 AM by BernhardSpuida. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 11-25-2007 3:45 PM

    • chaosben
    • Top 500 Contributor
    • Joined on 11-25-2007
    • Görlitz
    • Posts 6

    Searching for designer generated code

    Hi!

    In order to improve the the speed of developing CF applications, i need to find the place in the SD source code, where the source code is generated for the components, which are dropped in the designer.  At the moment i'm "staying" in des DesignerGenerator directory, but i dont know, if it is the right place to go on with the resarch. 

    Please give me a hint.

    Thanks in advance.

    Benjamin

    If I have seen farther it is by standing on the shoulders of Giants. (Isaac Newton)
  • 11-25-2007 3:55 PM In reply to

    Re: Searching for designer generated code

    The generation works like this:

    1) The .NET Framework designer infrastructure serializes the form into a set of CodeDom statements (actually it creates a new class with fields for the controls and a single method: InitializeComponents, and puts the class into a CodeCompileUnit). 

    2) MergeFormChanges is called on the DesignerGenerator. The implementation AbstractDesignerGenerator uses the CodeDom code generator built into the .NET Framework to generate code in the target language for the InitializeComponents method body.

    3) The InitializeComponents method body is replaced with the new body. 

    4) Fields are added/removed/replaced as required.

     

    If you want to change the code generation, you would have to change the CodeCompileUnit before it is used to generate code in the target language. This could be done inside the AbstractDesignerGenerator.FixGeneratedCode method.

    Daniel Grunwald
  • 11-25-2007 8:04 PM In reply to

    • chaosben
    • Top 500 Contributor
    • Joined on 11-25-2007
    • Görlitz
    • Posts 6

    Re: Searching for designer generated code

    Hi Daniel!

    Thank you very much for this fast and detailed answer. 

    I hope there will be some spare time tomorrow at work. :)

    The next question is: If i am able to write some usefull lines of code, is there a chance to get this code into a next release of SD? If yes, it would be a great incentive. ;) 

    Benjamin

    If I have seen farther it is by standing on the shoulders of Giants. (Isaac Newton)
  • 11-26-2007 9:28 AM In reply to

    Re: Searching for designer generated code

    Of course you can contribute code to #develop. Just follow the instructions given on this wiki page to join the effort. We look forward to seeing your code.

Page 1 of 1 (4 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.