Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Design Time / June 2007

Tip: Looking for answers? Try searching our database.

How do you persist and restore forms with the CodeDomDesignerLoade

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Rust - 12 Jun 2007 14:51 GMT
I'm implemented a forms editing environment based on the MSDN example:
http://msdn.microsoft.com/msdnmag/issues/06/03/designerhosting/default.aspx.  
My DesignerLoader derives from CodeDomDesignerLoader, and I'd like to persist
the form definition to a file so that it can be subsequenly reopened and
edited.  I can persist the CodeCompileUnit to a file using the
BinaryFormatter, and I can recreate the CodeCompileUnit from the file using
the following code:

SAVING

FileStream fs = new FileStream("e:\\temp\\ccu.dat", FileMode.Create);
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(fs, codeCompileUnit);
fs.Close();

LOADING

FileStream fs = new FileStream("e:\\temp\\ccu.dat", FileMode.Open);
BinaryFormatter formatter = new BinaryFormatter();
ccu = (CodeCompileUnit)formatter.Deserialize(fs);
fs.Close();

I return the inflated CodeCompileUnit from my implementation of
CodeDomDesignerLoader.Parse, but the form is only properly reconstructed in
the form designer if it contains no child controls.  As soon as I add a child
control (doesn't matter which one), I'm unable to restore the form using the
persisted CodeCompileUnit.  Note that I have this problem even if the child
controls do not reference resource data.  What do I need to do to
successfully restore the form from persistent storage?

Thanks,
Bill
Linda Liu [MSFT] - 13 Jun 2007 13:08 GMT
Hi Bill,

This is a quick note to let you know that I am performing research on this
issue and will get back to you ASAP.

I appreciate your patience!

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Linda Liu [MSFT] - 15 Jun 2007 09:36 GMT
Hi Bill,

There's no direct way to parse source code to CodeCompileUnit object. You
may need to analysis every line of statement in the source code and
construct a CodeDOM object model.

It seems that it is not an easy job. I search the Internet and find a
parser called CS CODEDOM Parser, which is a utility to parse the C# source
code and creates the CODEDOM tree of the code.

You may refer to the following article for more information on this.

'CS CODEDOM Parser'
http://www.c-sharpcorner.com/UploadFile/ivan.zderadicka/CsCodeParser12052005
234428PM/CsCodeParser.aspx

Hope this helps.

Sincerely,
Linda Liu
Microsoft Online Community Support
Linda Liu [MSFT] - 20 Jun 2007 07:27 GMT
Hi Bill,

How about the problem now?

If you need our further assistance, please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.