Reflection Studio – Document Factory

This is a description of the document factory implemented into my codeplex project (http://reflectionstudio.codeplex.com/)

1 – An Open command is fired from the application (for exemple a double-click on a template file) with a file context “DiskContent”. This command is routed to the execute handler defined in the MainWindow

2 – Here, we call the DocumentFactory with the OpenDocument( DiskContent dc ) method. It will search in the supported document list if we can open a file based on his extension. We get in return a SupportedDocumentInfo structure that contains everything we need to open a document

3 – We create by reflection a new DataContext with the file name comming from the command. This will automatically create the file service needed to read/write the file

4 – We create by reflection the associated document user control by passing it the DataContext and SupportedDocInfo structures

All the rest of operation for load the document is done automatically by the framework. When the user control is loaded, it calls functions that goes through Datacontext, FileService.

Enjoy 🙂

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s