AddSampleStageDialog.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace Metis.AutoAnalysis
  11. {
  12. public partial class AddSampleStageDialog : Form
  13. {
  14. Dictionary<string, SampleStageModel> _list;
  15. public AddSampleStageDialog(Dictionary<string, SampleStageModel> list)
  16. {
  17. InitializeComponent();
  18. _list = list;
  19. }
  20. public Action<string> CallBack;
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. var name = textBox1.Text.Trim();
  24. if (!string.IsNullOrEmpty(name))
  25. {
  26. if (_list.Keys.Contains(name))
  27. {
  28. MessageBox.Show("重复命名");
  29. }
  30. else
  31. {
  32. CallBack.Invoke(name);
  33. Close();
  34. }
  35. }
  36. else
  37. {
  38. MessageBox.Show("名字不能为空");
  39. }
  40. }
  41. private void button2_Click(object sender, EventArgs e)
  42. {
  43. Close();
  44. }
  45. }
  46. }