Пример #1
0
        public IEnumerable <ProviderModelContainer> GetModels()
        {
            var definitions = DefinitionsFacade.GetDefinitions();

            foreach (var def in definitions)
            {
                string executor = null;

                if (def.Settings != null)
                {
                    executor = def.Settings.GetFormExecutor(def);
                }

                if (def is DynamicFormDefinition form)
                {
                    var function = new StandardFormFunction <DynamicFormBuilderRequestContext>(form.Model);

                    if (!String.IsNullOrEmpty(executor))
                    {
                        function.OverrideFormExecutor = executor;
                    }

                    yield return(new ProviderModelContainer
                    {
                        Source = typeof(DynamicModelsProvider),
                        Type = "DynamicForm",
                        Model = form.Model,
                        Function = function
                    });
                }

                if (def is DynamicWizardDefinition wizard)
                {
                    var function = new FormWizardFunction <DynamicFormWizardRequestContext>(wizard.Model);

                    if (!String.IsNullOrEmpty(executor))
                    {
                        function.OverrideFormExecutor = executor;
                    }

                    yield return(new ProviderModelContainer
                    {
                        Source = typeof(DynamicModelsProvider),
                        Type = "DynamicWizard",
                        Model = wizard.Model,
                        Function = function
                    });
                }
            }
        }
 public static DynamicFormDefinition GetFormByName(string name)
 {
     return((DynamicFormDefinition)DefinitionsFacade.GetDefinition(name));
 }
 public static IEnumerable <DynamicFormDefinition> GetFormDefinitions()
 {
     return(DefinitionsFacade.GetDefinitions().OfType <DynamicFormDefinition>());
 }
 public static IEnumerable <DynamicWizardDefinition> GetWizards()
 {
     return(DefinitionsFacade.GetDefinitions().OfType <DynamicWizardDefinition>());
 }
 public static DynamicWizardDefinition GetWizard(string wizardName)
 {
     return((DynamicWizardDefinition)DefinitionsFacade.GetDefinition(wizardName));
 }