Esempio n. 1
0
        public Dictionary <string, object> Configure()
        {
            Dictionary <string, object> result = new Dictionary <string, object>();

            result.Add("DefaultValue", txtDefaultValue.Text);
            List <ItemOption> options = new List <ItemOption>();

            foreach (DataGridViewRow row in gridOptions.Rows)
            {
                if (row.Cells[0].Value != null)
                {
                    string     value = Convert.ToString(row.Cells[0].Value);
                    string     text  = Convert.ToString(row.Cells[1].Value);
                    ItemOption item  = new ItemOption(value, text);
                    options.Add(item);
                }
            }
            result.Add("Options", options);
            return(result);
        }
Esempio n. 2
0
        public void DisplayConfiguration(Dictionary <string, object> configs)
        {
            txtDefaultValue.Text = Convert.ToString(configs["DefaultValue"]);
            List <ItemOption> options = new List <ItemOption>();

            if (configs["Options"].GetType() == typeof(ArrayList))
            {
                ArrayList list = (ArrayList)configs["Options"];
                foreach (Dictionary <string, object> item in list)
                {
                    ItemOption newItem = new ItemOption(item["Value"].ToString(), item["Text"].ToString());
                    options.Add(newItem);
                }
            }
            else
            {
                options = (List <ItemOption>)configs["Options"];
            }

            DisplayOptions(options);
            //gridOptions.DataSource = options;
        }