コード例 #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            //
            Dictionary <string, string> lst = new Dictionary <string, string>();

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                string name = VPLUtil.ObjectToString(dataGridView1.Rows[i].Cells[0].Value);
                string val  = VPLUtil.ObjectToString(dataGridView1.Rows[i].Cells[1].Value);
                if (!string.IsNullOrEmpty(name) || !string.IsNullOrEmpty(val))
                {
                    if (string.IsNullOrEmpty(name))
                    {
                        name = val;
                    }
                    if (string.IsNullOrEmpty(val))
                    {
                        val = name;
                    }
                }
                if (!string.IsNullOrEmpty(name))
                {
                    lst.Add(name, val);
                }
            }
            WebDataEditorLookup de = this.SelectedEditor as WebDataEditorLookup;

            if (de == null)
            {
                de = new WebDataEditorLookup();
                this.SetSelection(de);
            }
            de.values         = lst;
            this.DialogResult = DialogResult.OK;
        }
コード例 #2
0
        public DlgEditNameValueList(DataEditor editor)
            : base(editor)
        {
            InitializeComponent();
            WebDataEditorLookup delk = editor as WebDataEditorLookup;

            if (delk != null)
            {
                LoadData(delk.values);
            }
        }
コード例 #3
0
        protected override void OnClone(DataEditor cloned)
        {
            base.OnClone(cloned);
            WebDataEditorLookup obj = cloned as WebDataEditorLookup;

            if (values != null)
            {
                obj.values = new Dictionary <string, string>();
                foreach (KeyValuePair <string, string> kv in values)
                {
                    obj.values.Add(kv.Key, kv.Value);
                }
            }
        }