1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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 ModifySampleStageDialog : Form
- {
- Dictionary<string, SampleStageModel> _list;
- string _name;
- public ModifySampleStageDialog(Dictionary<string, SampleStageModel> list, string name)
- {
- InitializeComponent();
- textBox1.Text = name;
- _list = list;
- _name = name;
- }
- public Action<string> CallBack;
- private void button1_Click(object sender, EventArgs e)
- {
- var name = textBox1.Text.Trim();
- if (!string.IsNullOrEmpty(name))
- {
- if (_name == name)
- Close();
- else if (_list.Keys.Contains(name))
- {
- MessageBox.Show("重复命名");
- }
- else
- {
- CallBack.Invoke(name);
- Close();
- }
- }
- else
- {
- MessageBox.Show("名字不能为空");
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- Close();
- }
- }
- }
|