Skip to content

Add New Code and Parts to Your Application

Gary edited this page Aug 27, 2014 · 1 revision

Table of Contents

Add the application's unique features, using the appropriate ATF classes and components, starting with the most important features. This can entail creating components of your own, although it doesn't for LandscapeGuide.

Because it is simple and similar to SimpleDOMEditor, the only remaining things to add to LandscapeGuide are resources for the plant and ornamentation icons.

Add Resources

Using a drawing tool of your choice, create plant and ornamentation icons the same size as the resource icons in SimpleDOMEditor. Add them to the project. When you add the icon files to the project, set their properties:

  • Build Action: Embedded Resource
  • Copy to Output Directory: Do not copy
If you do not embed the resources, you get compilation errors or an unhandled exception of type System.ComponentModel.Composition.CompositionException in Atf.Core.dll when you try to run the application.

Finally, add your resources to the Resources class in Resources.cs:

/// <summary>
/// Plant image resource filename</summary>
[ImageResource("plant.png")]
public static readonly string PlantImage;

/// <summary>
/// Ornamentation image resource filename</summary>
[ImageResource("ornamentation.png")]
public static readonly string OrnamentationImage;

Add Data Persistence

You generally want to save user edited data some way, usually in a file. SimpleDOMEditor does this by using ATF DOM classes for data persistence. The XML schema data model specified in the type definition file also specifies the XML format of saved data. If you want to use the ATF DOM and XML to save user data, you don't need to change anything. If you want to save data in some other format, you have additional code to write. You can base what you do on the ATF DOM DomXmlReader and DomXmlWriter classes. For information on data persistence with the ATF DOM, see the ATF Programmer’s Guide: Document Object Model (DOM), which you can download at ATF Documentation.

Topics in this section

Clone this wiki locally