Exemplo n.º 1
0
        /// <summary>
        /// Create a new option that can hold a list of items.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="optionName"></param>
        /// <param name="type"></param>
        /// <param name="isOptional"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public IOptionsSchema List_CreateOption <T>(string optionName, Type type, bool isOptional, List <T> list)
        {
            var schema = OptionsSchema.CreateOptionsSchema <T>(optionName, type, isOptional, list);

            OptionDefinitions.Add(optionName, schema);
            IsDirty = true;

            return(schema);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Add another option and its definition (schema) into this option group.
        /// </summary>
        /// <param name="optionName"></param>
        /// <param name="type"></param>
        /// <param name="IsOptional"></param>
        /// <param name="value"></param>
        internal IOptionsSchema AddOption(string optionName, Type type, bool IsOptional, object value)
        {
            var schema = new OptionsSchema(optionName, type, IsOptional, value);

            OptionDefinitions.Add(optionName, schema);
            IsDirty = true;

            return(schema);
        }
Exemplo n.º 3
0
        public string Schema()
        {
            var fields = new List <FieldSchema>();

            fields.Add(new FieldSchema("STATUS", "status", "Action", 5));

            fields.Add(new FieldSchema("COLLECTION NAME", "name", "Text", 0, true).AddAttributes("maxlength", 10));
            var moduleField = new FieldSchema("MODULE NAME", "module_name", "Select", 1, true)
            {
                dynamic = true,
                temp    = false
            };

            foreach (var module in ModuleManager.Instance.SourceModules)
            {
                var moduleOptions = new OptionsSchema(module.Key, module.Key);
                var methodField   = new FieldSchema("METHOD NAME", "method_name", "Select", 1, true)
                {
                    dynamic = true, temp = true
                };
                foreach (var method in module.Value.GetConfig())
                {
                    var methodOptions = new OptionsSchema(method.Key, method.Key);

                    foreach (var options in method.Value)
                    {
                        var optionsField = new FieldSchema(options.Key, options.Key, "Text", 2, false)
                        {
                            temp = true, datakey = "options"
                        };
                        methodOptions.AddFields(optionsField);
                    }

                    methodField.AddOptions(methodOptions);
                }
                moduleOptions.AddFields(methodField);
                moduleField.AddOptions(moduleOptions);
            }
            fields.Add(moduleField);

            var actionTypeField = new FieldSchema("ACTION TYPE", "action_type", "Select", 3, true)
            {
                dynamic = true,
                temp    = false
            }.AddOptions(new OptionsSchema("schedule", "예약 실행").AddFields(new FieldSchema("WEEKDAYS", "weekdays", "MultiSelect", 4, false)
            {
                temp = true, datakey = "schedule"
            }
                                                                          .AddOptions(new OptionsSchema("MON", "월요일"))
                                                                          .AddOptions(new OptionsSchema("TUE", "화요일"))
                                                                          .AddOptions(new OptionsSchema("WED", "수요일"))
                                                                          .AddOptions(new OptionsSchema("THU", "목요일"))
                                                                          .AddOptions(new OptionsSchema("FRI", "금요일"))
                                                                          .AddOptions(new OptionsSchema("SAT", "토요일"))
                                                                          .AddOptions(new OptionsSchema("SUN", "일요일")))
                         .AddFields(new FieldSchema("START", "start", "TimePicker", 5, false)
            {
                datakey = "schedule", temp = true
            })
                         .AddFields(new FieldSchema("END", "end", "TimePicker", 5, false)
            {
                datakey = "schedule", temp = true
            })
                         .AddFields(new FieldSchema("INTERVAL", "interval", "Number", 5, false)
            {
                datakey = "schedule", temp = true
            }))
            .AddOptions(new OptionsSchema("once", "즉시 실행"));

            fields.Add(actionTypeField);

            fields.Add(new FieldSchema("UPDATED TIME", "unixtime", "Data", 6));

            return(DataConverter.Serializer <List <FieldSchema> >(fields));
        }