internal string GetFormFullName(FormDefinition formDefinition)
 {
     try
     {
         FormNamespace formNamespace = _formNamespaces[formDefinition.NamespaceReference];
         return(string.Format("{0}.{1}", formNamespace.Path, formDefinition.Form));
     }
     catch (KeyNotFoundException ex)
     {
         throw new FormMappingNotFoundException(string.Format("There is no namespace definition for '{0}'", formDefinition.NamespaceReference), ex);
     }
 }
        private void ParseFormMappings(XDocument doc)
        {
            var ns = doc.Root.Element("Namespaces");

            if (ns != null)
            {
                _formNamespaces = new Dictionary <string, FormNamespace>();

                foreach (XElement n in ns.Elements())
                {
                    if (n is XElement)
                    {
                        FormNamespace fns = new FormNamespace(n);
                        _formNamespaces.Add(fns.ID, fns);
                    }
                }
            }

            // Loading skin - pending

            // Loading form mappings
            try
            {
                var e = doc.Root.Elements("activity");

                foreach (XElement activityElement in e)
                {
                    FormDefinition formDefinition = new FormDefinition(activityElement);
                    this.Add(formDefinition.ID, formDefinition);

                    XAttribute defaultAttribute = activityElement.Attribute("default");

                    if (defaultAttribute != null)
                    {
                        bool defaultValue;
                        Boolean.TryParse(defaultAttribute.Value, out defaultValue);

                        if (defaultValue)
                        {
                            DefaultMapping = formDefinition;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw new FormMappingException("An error occurred loading the form mappings", ex);
            }
        }