private void buttonSystemProperty_Click(object sender, EventArgs e) { var s = _sss.SystemProperty; AddDefinition <SystemProperty> ads = new AddDefinition <SystemProperty>(s); ads.ShowDialog(); }
private void buttonAdd_Click(object sender, EventArgs e) { // AddDefinition <T> formAddDefinition = new AddDefinition <T>(); var res = formAddDefinition.ShowDialog(); T def = (T)formAddDefinition.Instance; if (res == DialogResult.OK) { string errorMessage; if (CheckAddDefinition(_definitions, def, out errorMessage)) { _definitions.Add((T)def); } else { MessageBox.Show(errorMessage, "添加参数定义出错", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void buttonEdit_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex >= 0) { T item = (T)listBox1.SelectedItem; T itemClone = (T)item.Clone(); // AddDefinition <T> formAddDefinition = new AddDefinition <T>(itemClone); var res = formAddDefinition.ShowDialog(); if (res == DialogResult.OK) { string errorMessage; if (CheckEditDefinition(_definitions, item, itemClone, out errorMessage)) { _definitions[listBox1.SelectedIndex] = (T)formAddDefinition.Instance; } else { MessageBox.Show(errorMessage, "编辑参数定义出错", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
private void buttonShaft_Click(object sender, EventArgs e) { AddDefinition <SocketedShaft> dds = new AddDefinition <SocketedShaft>(_sss.SocketedShaft); dds.ShowDialog(); }