public override IDynamicDefinition Load(string name, XElement xml) { var wizard = new DynamicWizardDefinition(name); var requiresCaptchaAttribute = xml.Attribute("requiresCaptcha"); if (requiresCaptchaAttribute != null) { wizard.Model.RequiresCaptcha = bool.Parse(requiresCaptchaAttribute.Value); } var forceHttpsConnectionAttribute = xml.Attribute("forceHttpsConnection"); if (forceHttpsConnectionAttribute != null) { wizard.Model.ForceHttps = bool.Parse(forceHttpsConnectionAttribute.Value); } var stepsElement = xml.Element("Steps"); foreach (var stepElement in stepsElement.Elements("Step")) { var labelAttr = stepElement.Attribute("Label"); var wizardStep = new WizardStepModel { Name = stepElement.Attribute("Name").Value, FormName = stepElement.Attribute("FormName").Value, LocalOrdering = int.Parse(stepElement.Attribute("LocalOrdering").Value), }; wizardStep.Label = labelAttr != null ? labelAttr.Value : wizardStep.Name; var nextButtonLabelAttribute = stepElement.Attribute("nextButtonLabel"); if (nextButtonLabelAttribute != null) { wizardStep.NextButtonLabel = nextButtonLabelAttribute.Value; } var previousButtonLabelAttribute = stepElement.Attribute("previousButtonLabel"); if (previousButtonLabelAttribute != null) { wizardStep.PreviousButtonLabel = previousButtonLabelAttribute.Value; } wizard.Model.Steps.Add(wizardStep); } ParseSubmitHandlers(xml, wizard); ParseFormSettings(xml, wizard); return(wizard); }
public static void SaveWizard(DynamicWizardDefinition wizard) { var serializer = new WizardXmlSerializer(); serializer.Save(wizard); }