public void NewObject() { if (mObjectList == null) { return; } T newObject = (mCreateObjectProc != null) ? mCreateObjectProc() : Activator.CreateInstance <T>(); InputValueDlg dlg = new InputValueDlg("新建", newObject); if (dlg.ShowDialog() == DialogResult.OK) { mObjectList.Add(newObject); ShowData(); } }
void EditObject() { if (mListView.SelectedIndices.Count == 0) { return; } T select_obj = (T)mListView.SelectedItems[0].Tag; if (select_obj == null) { return; } InputValueDlg dlg = new InputValueDlg("编辑单个对象", select_obj); if (dlg.ShowDialog() == DialogResult.OK) { ShowData(); } }