Loading from an XML-manifest

If you don't want to clutter your classes with attributes, want to be able to change labels later on (think translation), or just have a plain grudge against reflection, fear not! Selene has built-in support to read all neccesary data from an XML manifest file at the instruction of but one attribute, namely ControlManifest(string). It also provides the ability to stub a manifest for you through plain reflection. Consider the following:

manifest.cs

Gtk frontend

Qt frontend

The first time you run this example, it will detect the absence of the manifest file and stub one via reflection. After that, it will exit like nothing happened. Then it's your task to edit the manifest file into something you like.

It's all pretty self-explaining once you've seen the XML. For this example's sake we have edited the XML file as shown below. Running it with that in the manifest will produce the above screenshots.

Be careful with the Name="" attributes though. If you want to change the label, you should change the Label subtag in there. Goofing up the name attribute means the introspector (the piece of code that prepares the tree of widgets) will barf on a kitten because it cannot find the field you specified.

manifest.xml