The DSL Tools automate all of the heavy lifting work to actually produce your designer, which takes advantage of the Designer platform.
This automation is done through the use of templates that use the templating technology included with the DSL Tools. These templates are akin to ASP.NET in that you define the code you wish to be generated and then insert tags to vary the code generated. You can see these templates in your solution as files with an extension of .dslddt.
The first step to generate your designer is to run the templates to generate the code. You can do this by clicking the button to "transform all templates" on the Solution Explorer toolbar. This toolbar button is highlighted in Figure 6-13.
The templates are executed and several code files are generated, which you can view in the Solution Explorer nested under the .dslddt files when you click the "show all files" button on the Solution Explorer toolbar.
If you have mistyped any names in the Designer Definition file, errors will be generated during template execution, which should point you at the area that needs to be changed.
Once the designer has been successfully built, you can press F5 to run the Designer. The DSL Tools Project Wizard automatically creates a debugging project within which you can test your designer; pressing F5 launches the designer with this project.
Any designer you write using the DSL Tools is configured to work in the "Experimental" version of Visual Studio that the Visual Studio SDK configures during installation. This is identical to your usual Visual Studio IDE except that it has a different registry hive, so any designer registrations don't affect your core developing environment. To support debugging, your designer can be configured for the normal instance of Visual Studio as required.
When the designer loads, you will see a file in the debugging project called empty.<yourdesigner extension>. Double-clicking this file will display the design surface and the toolbox, with your graphical items listed as shown in Figure 6-14.
You can now drag Pages onto the Diagram and change the name by clicking on the Decorator or using the Properties pane. You can also use connectors to connect shapes together. You can use all the tools together to produce a navigation model, as depicted in Figure 6-15.
During the construction of your language model using the graphical designer, you can view the navigation domain model as it's constructed, using the Explorer that the DSL Tools Project Wizard installs as part of your designer. If the Explorer is not visible, you can make it visible by selecting View Other Windows NavigationDesigner Explorer. In Figure 6-16, you can see the domain model for the navigation model defined in Figure 6-15, created by dragging shapes onto the designer.
All designers leverage the rich designer platform in Visual Studio 2005. You can zoom in and out of the diagram by holding down Ctrl+ Shift and pressing the left mouse button to zoom in or the right mouse button to zoom out. You also get Resize, Undo, and Redo functionality for free.
When you save this navigation model, it is stored as an XML file that contains all of the navigation model information. You can, of course, override the save logic to save to another file format if required, and provide the corresponding load logic to rebuild the navigation model using the object model created for you.