void mi_click(object sender, EventArgs e) { if (dataGridView1.CurrentCell != null && dataGridView1.CurrentCell.ColumnIndex == 1) { MenuItem mi = sender as MenuItem; if (mi != null) { Type t = mi.Tag as Type; if (t != null) { NamedDataType ndt = dataGridView1.CurrentCell.Value as NamedDataType; if (ndt == null) { ndt = new NamedDataType(t, string.Empty); dataGridView1.CurrentCell.Value = ndt; } else { ndt.SetDataType(t); } dataGridView1.Refresh(); } } } }
private void btOK_Click(object sender, EventArgs e) { Results = new List <NamedDataType>(); StringCollection names = new StringCollection(); for (int i = 0; i < _dataTable.Rows.Count; i++) { NamedDataType ndt = (_dataTable.Rows[i][1]) as NamedDataType; if (ndt == null) { MessageBox.Show(this, "Data Type cannot be empty", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string name = (_dataTable.Rows[i][0]) as string; if (string.IsNullOrEmpty(name)) { MessageBox.Show(this, "Name cannot be empty", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ndt.Name = name; if (names.Contains(ndt.Name)) { MessageBox.Show(this, "Do not use same names", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } names.Add(ndt.Name); Results.Add(ndt); } this.DialogResult = DialogResult.OK; }
public override object Clone() { NamedDataType obj = (NamedDataType)base.Clone(); obj._id = _id; obj._name = _name; return(obj); }
public IList <NamedDataType> GetParameters() { List <NamedDataType> ps = new List <NamedDataType>(); ConstructorInfo ci = ConstructInfo; if (ci != null) { ParameterInfo[] pifs = ci.GetParameters(); if (pifs != null) { for (int i = 0; i < pifs.Length; i++) { NamedDataType nt = new NamedDataType(pifs[i].ParameterType, pifs[i].Name); ps.Add(nt); } } } return(ps); }