Example #1
0
        public void ApplyTemplate(TunableShapeTemplate <ShapeColumnTemplate> template)
        {
            if (null == template)
            {
                throw new ArgumentNullException(nameof(template));
            }

            mTunableShape.ApplyTemplate(template);
        }
Example #2
0
        public void ApplyTemplate(TunableShapeTemplate <ShapeColumnTemplate> template)
        {
            if (null == template)
            {
                throw new ArgumentNullException(nameof(template));
            }

            var requestNumberSettings = _context.Session.AuthenticationService.GetRequestNumberSettings();

            mTunableShape.ApplyTemplate(template);

            var valuesWrapper =
                new RequestNumberSettingsFormValuesWrapper
            {
                Control1GenerationMethod = requestNumberSettings.Method,
                Control2Increment        = requestNumberSettings.Increment
            };

            mTunableShape.ApplyValues(valuesWrapper.CollectIncomeValues());
        }
        public static SubmitFormTemplate <WMColumnTemplate> LoadSubmitFormTemplate(string filePath)
        {
            if (null == filePath)
            {
                throw new ArgumentNullException(nameof(filePath));
            }

            // SubmitFormTemplate
            var result = TryLoadSubmitFormTemplate(() =>
                                                   Utils.TemplateLoader.LoadTemplateFromJsonFile <SubmitFormTemplate <WMColumnTemplate> >(filePath));

            if (null != result)
            {
                return(result);
            }

            // TunableShapeTemplate
            result = TryLoadSubmitFormTemplate(() =>
            {
                var tunableShapeTemplate = Utils.TemplateLoader
                                           .LoadTemplateFromJsonFile <TunableShapeTemplate <WMColumnTemplate> >(filePath);

                var stepTemplates = new List <StepTemplate <WMColumnTemplate> >
                {
                    new StepTemplate <WMColumnTemplate>(tunableShapeTemplate, "action")
                };

                var submitFormTemplate = new SubmitFormTemplate <WMColumnTemplate>("text");
                submitFormTemplate.Steps.AddRange(stepTemplates);

                return(submitFormTemplate);
            });

            if (null != result)
            {
                return(result);
            }

            // FilterFormTemplate
            result = TryLoadSubmitFormTemplate(() =>
            {
                var filterFormTemplate = Utils.TemplateLoader
                                         .LoadTemplateFromJsonFile <FilterFormTemplate <WMColumnTemplate> >(filePath);

                var tunableShapeTemplate =
                    new TunableShapeTemplate <WMColumnTemplate>();
                tunableShapeTemplate.Columns.Add(filterFormTemplate.FilterScreen.Column);

                var stepTemplates = new List <StepTemplate <WMColumnTemplate> >
                {
                    new StepTemplate <WMColumnTemplate>(tunableShapeTemplate, "action")
                };

                var submitFormTemplate = new SubmitFormTemplate <WMColumnTemplate>("text");
                submitFormTemplate.Steps.AddRange(stepTemplates);

                return(submitFormTemplate);
            });

            return(result);
        }