Beispiel #1
0
 public Parameter(String key, String caption, string description, ParameterType type, Object defaultValue, IParameterOptions options) : base(type)
 {
     this.key          = key;
     this.caption      = caption;
     this.description  = description;
     this.defaultValue = defaultValue;
     this.options      = options;
 }
Beispiel #2
0
        public override void Load(XmlElement xmlElem)
        {
            base.Load(xmlElem);
            this.key          = xmlElem.GetAttribute("key");
            this.caption      = xmlElem.GetAttribute("caption");
            this.description  = xmlElem.GetAttribute("description");
            this.defaultValue = Parse(xmlElem.GetAttribute("defaultValue"), this.ParameterType);
            XmlNodeList nodes = xmlElem.GetElementsByTagName("option");

            if (nodes != null && nodes.Count > 0)
            {
                this.options = new ParameterOptions(this.ParameterType);
                this.options.Load((XmlElement)nodes[0]);
            }
        }
Beispiel #3
0
        public ParameterControl_Option(IParameter parameter) : base(parameter)
        {
            this.comboBox = new ComboBox();
            this.comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
            IParameterOptions       options    = parameter.Options;
            List <IParameterOption> optionList = options.Options;
            int selectIndex = 0;

            for (int i = 0; i < optionList.Count; i++)
            {
                IParameterOption option = optionList[i];
                this.comboBox.Items.Add(option.Value);
                if (option.Value.Equals(parameter.Value))
                {
                    selectIndex = i;
                }
            }
            comboBox.SelectedIndex = selectIndex;
        }
Beispiel #4
0
        private static IParameters GetParameters()
        {
            IParameters parameters = ParameterFactory.CreateParameters();

            parameters.AddParameter("ma1", "ma1", "ma1", ParameterType.INTEGER, 5);
            parameters.AddParameter("ma2", "ma2", "ma2", ParameterType.INTEGER, 10);
            parameters.AddParameter("ma3", "ma3", "ma3", ParameterType.INTEGER, 20);
            parameters.AddParameter("ma4", "ma4", "ma4", ParameterType.INTEGER, 40);
            parameters.AddParameter("ma5", "ma5", "ma5", ParameterType.INTEGER, 60);

            IParameterOptions options = ParameterFactory.CreateParameterOptions(ParameterType.INTEGER, new object[] { 5, 10, 20, 40, 60 });

            parameters.AddParameter("test", "testc", "testd", ParameterType.INTEGER, 0, options);

            parameters.SetParameterValue("ma1", 5);
            parameters.SetParameterValue("ma2", 10);
            parameters.SetParameterValue("ma3", 20);
            parameters.SetParameterValue("ma4", 40);
            parameters.SetParameterValue("ma5", 60);
            return(parameters);
        }
Beispiel #5
0
        public void AddParameter(string key, string caption, string desc, ParameterType parameterType, object defaultValue, IParameterOptions options)
        {
            Parameter pm = new Parameter(key, caption, desc, parameterType, defaultValue, options);

            AddParameter(pm);
        }