Пример #1
0
        public TContainer AddOrUpdateVariableTemplate(string name, string label, IDictionary <string, string> displaySettings, string defaultValue, string helpText)
        {
            var existing = container.Templates.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase));

            if (existing == null)
            {
                var template = new ActionTemplateParameterResource
                {
                    Name            = name,
                    Label           = label,
                    DisplaySettings = displaySettings,
                    DefaultValue    = new PropertyValueResource(defaultValue, IsSensitive(displaySettings)),
                    HelpText        = helpText
                };

                container.Templates.Add(template);
            }
            else
            {
                existing.Name            = name;
                existing.Label           = label;
                existing.DisplaySettings = displaySettings;
                existing.DefaultValue    = new PropertyValueResource(defaultValue, IsSensitive(displaySettings));
                existing.HelpText        = helpText;
            }

            return(container);
        }
Пример #2
0
        public ProjectResource AddOrUpdateVariableTemplate(string name, string label, IDictionary <string, string> displaySettings)
        {
            var existing = Templates.FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.OrdinalIgnoreCase));

            if (existing == null)
            {
                var template = new ActionTemplateParameterResource
                {
                    Name            = name,
                    Label           = label,
                    DisplaySettings = displaySettings
                };

                Templates.Add(template);
            }
            else
            {
                existing.Name            = name;
                existing.Label           = label;
                existing.DisplaySettings = displaySettings;
            }

            return(this);
        }