using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Metis.AutoAnalysis { public partial class AddSampleStageDialog : Form { Dictionary _list; public AddSampleStageDialog(Dictionary list) { InitializeComponent(); _list = list; } public Action CallBack; private void button1_Click(object sender, EventArgs e) { var name = textBox1.Text.Trim(); if (!string.IsNullOrEmpty(name)) { if (_list.Keys.Contains(name)) { MessageBox.Show("重复命名"); } else { CallBack.Invoke(name); Close(); } } else { MessageBox.Show("名字不能为空"); } } private void button2_Click(object sender, EventArgs e) { Close(); } } }