public WizardStep(WizardStepModel model)
        {
            var formModel = ModelsFacade.GetModel <FormModel>(model.FormName);

            Model = model;
            Form  = new Form(formModel);
        }
Esempio n. 2
0
        public override void OnFinish(object sender, EventArgs e)
        {
            var folderToken = (FormFolderEntityToken)EntityToken;
            var stepName    = GetBinding <string>("StepName");
            var formName    = GetBinding <string>("FormName");

            var wizard = DynamicWizardsFacade.GetWizard(folderToken.FormName);
            var step   = new WizardStepModel
            {
                Name          = stepName,
                FormName      = formName,
                Label         = stepName,
                LocalOrdering = wizard.Model.Steps.Count + 1
            };

            wizard.Model.Steps.Add(step);

            DynamicWizardsFacade.SaveWizard(wizard);

            var wizardStepToken = new FormWizardStepEntityToken(wizard.Name, step.Name);
            var workflowToken   = new WorkflowActionToken(typeof(EditWizardStepWorkflow));

            CreateAddNewTreeRefresher(EntityToken).PostRefreshMessages(wizardStepToken);
            ExecuteAction(wizardStepToken, workflowToken);
        }
        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);
        }